sqldiff postgres bigserial patch

52 views
Skip to first unread message

JimC

unread,
Mar 7, 2013, 8:04:34 AM3/7/13
to django-e...@googlegroups.com
We've recently migrated from Django 1.3 -> 1.5, and of course upgraded to the latest django-extensions.  One thing we noticed was that the sqldiff command does not correctly understand postgres tables with bigserial fields.  The result is that every invocation of sqldiff generates SQL changes -- and worse, the changes are not valid postgres code.

Not a big deal -- but here's a quick patch to address:

--- management/commands/sqldiff.py.ORIG 2013-03-07 07:29:28.000000000 -0500
+++ management/commands/sqldiff.py      2013-03-07 07:49:33.000000000 -0500
@@ -553,8 +553,11 @@
         if not db_type:
             return
         if field:
-            if field.primary_key and db_type == 'integer':
-                db_type = 'serial'
+            if field.primary_key:
+                if db_type == 'integer':
+                    db_type = 'serial'
+                elif db_type == 'bigint':
+                    db_type = 'bigserial'
             if table_name:
                 tablespace = field.db_tablespace
                 if tablespace == "":

trbs

unread,
Mar 7, 2013, 9:01:44 AM3/7/13
to django-e...@googlegroups.com
Thanks, your patch has been applied.

I'll try to do a new release on pypi within a couple of hours so people can update their requirements files.

Jim Carroll

unread,
Mar 7, 2013, 9:13:55 AM3/7/13
to django-e...@googlegroups.com

Wow – I think you take the prize for the greatest Django add-on AND fastest response !

 

Jim C.

 

--
You received this message because you are subscribed to the Google Groups "django-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-extensi...@googlegroups.com.
To post to this group, send email to django-e...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-extensions?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages