Ticket #919 (infoneeded defect)

Opened 4 years ago

Last modified 4 years ago

sqlite columns re-ordered unexpectedly after delete/update column

Reported by: absoludity+south@… Owned by: andrew
Priority: major Milestone:
Component: commands Version: 0.7
Keywords: Cc:


I have a simple migration:

class Migration:

    def forwards(self, orm):
        # Deleting field 'SoftwareItem.app_name'
        db.delete_column('reviewsapp_softwareitem', 'app_name')

    def backwards(self, orm):
        # Adding field 'SoftwareItem.app_name'
        db.add_column('reviewsapp_softwareitem', 'app_name', orm['reviewsapp.softwareitem:app_name'])   

With 0.6 everything worked fine, but with 0.7, the columns are being re-ordered (as can be seen by putting a pdb in the migration and inspecting the schema before and after the call):

Before 0008_remove_softwareitem_app_name:

sqlite> .schema reviewsapp_softwareitem
CREATE TABLE "reviewsapp_softwareitem" (
"id" integer NOT NULL PRIMARY KEY,
"package_name" varchar(100) NOT NULL,
"app_name" varchar(100) NOT NULL,
"ratings_total" integer NOT NULL DEFAULT 0,
"ratings_average" decimal NOT NULL DEFAULT 0,
"date_ratings_updated" datetime NOT NULL DEFAULT '2010-12-09 20:47:18.200195');

After 0008_remove_softwareitem_app_name:

sqlite> .schema reviewsapp_softwareitem
CREATE TABLE "reviewsapp_softwareitem" (
"ratings_total" integer,
"ratings_average" decimal,
"id" integer PRIMARY KEY,
"package_name" varchar(100),
"date_ratings_updated" datetime);

Change History

comment:1 Changed 4 years ago by andrew

  • Status changed from new to infoneeded

This sounds like something we've fixed recently; have you tried with the latest development version?

Note: See TracTickets for help on using tickets.