Commits

and...@69d324d9-c39d-4fdc-8679-7745eae9e2c8  committed 17a0721

Migration prefix matching, and float support

  • Participants
  • Parent commits eeab9fa

Comments (0)

Files changed (3)

File db/generic.py

         "boolean": "BOOLEAN",
         "serial": "SERIAL",
         "datetime": "TIMESTAMP WITH TIME ZONE",
+        "float": "DOUBLE PRECISION",
     }
 
     def __init__(self):

File management/commands/startmigration.py

     type = {
         "varchar": "string",
         "timestamp with time zone": "datetime",
+        "double precision": "float",
     }.get(type, type)
     return type, param

File migration.py

             try:
                 target = migrations.index(target_name) + 1
             except ValueError:
-                print " ! '%s' is not a migration." % target_name
-                return
+                matches = [x for x in migrations if x.startswith(target_name)]
+                if len(matches) == 1:
+                    target = migrations.index(matches[0]) + 1
+                    print " - Soft matched migration %s to %s." % (
+                        target_name,
+                        matches[0]
+                    )
+                elif len(matches) > 1:
+                    print " - Prefix %s matches more than one migration:" % target_name
+                    print "     " + "\n     ".join(matches)
+                    return
+                else:
+                    print " ! '%s' is not a migration." % target_name
+                    return
     
     def describe_index(i):
         if i == 0: