Modify

Ticket #316 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

SQLIte migrations break sometimes when adding columns and then deleting/renaming columns

Reported by: hvdklauw@… Owned by: andrew
Priority: blocker Milestone: 0.7
Component: commands Version: 0.6.2
Keywords: Cc:

Description

The problem is with the self._fields

When adding a column and then deleting/altering one later in the migration the added columns will be gone because the code loops through the self._field[table_name] to create the temp table. But the added columns never get added.

Attachments

Change History

comment:1 follow-up: ↓ 2 Changed 4 years ago by andrew

  • Status changed from new to assigned
  • Milestone set to 0.7

Yes, the SQLite module is being rewritten for 0.7, so this will get fixed.

comment:2 in reply to: ↑ 1 Changed 4 years ago by hvdklauw@…

Replying to andrew:

Yes, the SQLite module is being rewritten for 0.7, so this will get fixed.

Ahh.. crap.. any way to quickfix it for 0.6.2..
I have a live website which needs some fixes, but I can't run migrations locally to get a local database up.

comment:3 Changed 4 years ago by andrew

Split it into two migrations, one for each field operation; that should solve it for now.

This might not be possible if you're trying to recreate a local database, though; if your migrations do nothing apart from schema changes, use ./manage.py syncdb --all to use syncdb for your migrated apps, then use ./manage.py migrate --fake to fake having done them.

comment:4 Changed 4 years ago by hvdklauw@…

Actually, splitting it up doesn't always seem to fix it.

The easiest fix is to call a self._populate_current_structure(table_name, force=True) at the end of the add_column function.

I'll fork the tag on bb and apply the fix.

comment:5 Changed 4 years ago by hvdklauw@…

Fix is here:

Gave it version number 0.6.2.1 so I can just pip installed it as an upgrade :)

http://bitbucket.org/MrOxiMoron/south/src/tip/south/

comment:6 Changed 4 years ago by andrew

  • Status changed from assigned to closed
  • Resolution set to fixed

Excellent, that's been merged into trunk. I'll close the ticket, as the SQLite code in 0.7 is entirely different, and I'm pretty sure this won't happen due to the way it's designed.

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.