paltman-archive / nashvegas

Another database migration script runner for Django projects.
http://paltman.github.com/nashvegas
MIT License
97 stars 18 forks source link

bug in migrations execution #22

Open marcinn opened 13 years ago

marcinn commented 13 years ago

There is a major bug in migrations execution. A set of migrations is executed in one transaction. Changes have to be commited in every iteration (for every migration/changeset).

Just try altering table structure by adding, then dropping columns, and try to set not null constraint on other field in same table (postgresql). There is no chance to execute that migration script. Splitting migration into separate files does not work.

Example:

alter table renting_request add column return_date date; update renting_request set return_date = rent_date + period; alter table renting_request drop column period; alter table renting_request alter column return_date set not null;

paltman commented 12 years ago

I agree that this is currently a bug in nashvegas and I appreciate the pull request, but I am not sure that is how I want to solve it at the moment. I know it's been months since you submitted the request and apologize for the delayed response.

The work around I have been using until I have some more time is to put:

COMMIT; BEGIN;

in between the SQL statements that require the transaction to finish before continuing.