Ticket #82 (closed task: fixed)

Opened 6 years ago

Last modified 6 years ago

Help with data migrations

Reported by: anonymous Owned by: andrew
Priority: trivial Milestone:
Component: databaseapi Version:
Keywords: Cc:

Description

Hi, I couldn't find the link to any mailing list, so I'm asking the question here:

Is there any API to do data migrations? I can't use Django models because the model may refer to a new version of the database in case I migrate down or drop tables and want to remigrate, or I want to setup on a new system.

Do I have to use raw SQL to do this? I was hoping not, because it defeats the idea of database independence. Is there any abstraction that South provides for moving data around during a migration?

Change History

comment:1 Changed 6 years ago by andrew

Unfortunately, at the moment, yes you do. We're working on including something similar to Migratory, who allow you to use the ORM inside migrations, but until then, it's the fun and the joy of raw SQL.

One possible, but ugly, workaround is to make a copy of your models.py file at that point and call it something like models_mig14 - that way you _should_ be able to include that instead and have it work (since it's frozen in time). However, it's horribly hackish-sounding and I've only just invented the idea, and I'm hoping to get the ORM in there soonish...

comment:2 Changed 6 years ago by andrew

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

Note that as of the latest few commits the ORM Freezer is now in and working, so that should help with data migrations.

Note: See TracTickets for help on using tickets.