Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing migration for Revision.project null=True #91

Closed
squiddy opened this issue Dec 3, 2011 · 9 comments
Closed

Missing migration for Revision.project null=True #91

squiddy opened this issue Dec 3, 2011 · 9 comments

Comments

@squiddy
Copy link
Contributor

squiddy commented Dec 3, 2011

I was going to work on #35, but when I wanted to create a new migration, south found another change:

$ python manage.py schemamigration codespeed --auto
 ? The field 'Revision.project' does not have a default specified, yet is NOT NULL.
 ? Since you are making this field nullable, you MUST specify a default
 ? value to use for existing rows. Would you like to:
 ?  1. Quit now, and add a default to the field in models.py
 ?  2. Specify a one-off value to use for existing columns now
 ?  3. Disable the backwards migration by raising an exception.

In 6cefd8e null=True was added to the definition of Revision.project, but apparently no migration was added.

If I'm not mistaken, each revision has a link to a project (a revision belongs to a branch, and that branch belongs to a project). Why can project be left out on a revision then?

@tobami
Copy link
Owner

tobami commented Dec 3, 2011

It is for historical reasons. Migrating from Revision->Project to Revision->Branch->Project was a bit messy (there are several scripts to migrate an old DB). In order for the migration to work, revision.project was left there.

I also do not like that python manage.py syncdb doesn't leave you with a new, clean DB. You need an extra step.

It would be a task for the next release (1.0.0?) to remove this migration artefact.

@squiddy
Copy link
Contributor Author

squiddy commented Dec 9, 2011

I also do not like that python manage.py syncdb doesn't leave you with a new, clean DB. You need an extra step.

Agreed. It probably is helpful to users migrating projects across releases, but is has its downsides (spending hours trying to migrate complex schema changes - what some lines of SQL can achieve).

But the issue is still there. I had to add a migration in two branches now to keep the commits separated. Should we include the migration that is missing (to have a clean base) or remove Revision.project right away? In my opinion, one of these should be done, if you plan to keep using south.

@tobami
Copy link
Owner

tobami commented Dec 10, 2011

IMO removing Revision.project would be a cleaner solution looking forward

@squiddy
Copy link
Contributor Author

squiddy commented Dec 10, 2011

Alright, I'll send a pull request then.

@tobami
Copy link
Owner

tobami commented May 17, 2012

@squiddy do you intend to send a pull request for this yet?

@squiddy
Copy link
Contributor Author

squiddy commented May 17, 2012

Yes, I'll send one today. Better late than never.

@tobami
Copy link
Owner

tobami commented May 17, 2012

Great, thanks

@squiddy
Copy link
Contributor Author

squiddy commented May 17, 2012

Hm, I underestimated the work involved. I doubt I'll have time for this.

First thing I noticed is that there seems to be a migration conflict. Two migrations occupy the same timeslot, 0011. Apparantly the conflict was not resolved, therefore south does not detect the 'commit_browsing_url' migration here and wants to create a new one. I don't know if recreating it as 0012 and deleting the old is enough.

Removing Revision.project breaks a lot of API tests. I had a quick look at the code, but it would take some time to understand it. Maybe a8 can help here?

@tobami
Copy link
Owner

tobami commented Mar 21, 2015

Migrations are clean now

@tobami tobami closed this as completed Mar 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants