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
SQL migration guide in upgrade docs is not clear #46
Comments
Looks like those docs need even more refinement alright. Unfortunately, how you went about this is not how I would do it, thus, I can't tell you whether your DB is consistent or not. I'll describe the process flow that I'd use, were I upgrading a pre-v1.0 instance. After that, I'd appreciate it if I could get a dump of your schema that I could compare to the "expected" version. To upgrade pre-v1.0 to v1.1:
This step works assuming you haven't any out-of-tree changes to your schema. If you have, that's a different ballgame and will require a custom solution. |
I'm trying to follow the steps you mention. I guess the migration information is stored in the database, and if i just revert the database to the previous state, the migration starts from zero. as you suggested I run
Then I remember i run
please remember I was using django 1.5 and now 1.8. (1.5 doesn't have any migration support right?). PS which version of the database schema would you like, the initial one or the one after upgrading? |
Yes, that should have read Could you give me the schema of your DB before applying Django migrations, but after applying any SQL migrations? Looks like your schema is not what Django is expecting, thus there may be a need to manually fix it before applying the migrations. Off the top of my head, you probably should migrate all tables (i.e. |
db after applying the 015 patch (think this is the only missing one). |
I don't see any 0006 patch, so i guess its coming from the 0005?
How does one run the migrations step by step? |
After comparing your schema to mine, I see no significant differences: some columns are bigger/smaller, while others are in different positions. This is to be expected though, seeing as mine were produced by Django migrate rather than SQL scripts. Regarding this output:
This seems to be a warning, rather than an error. Are you able to use the instance once done? If so, I think you can ignore this. |
This seems to work now on my existing DB: I am using MySQL so i need to fix the double quotes in the SQL migration files by adding this to the top of it:
Then import the missing sql files and run the migration as followed:
No further migrations seem necessary. I think the error happends when you first run the migration differently, and want to run it afterwards with the fake switches. |
@stephenfin - this has been sitting around for a while and predates 2.0 - are there any doc or migration changes still needed? |
Nope, I think we're good. I removed the manual migration information for the 2.1 documentation, so I think we can close this unless other issues are experienced. |
First of all, I dont have any experiance with django so sorry if I'm taking wrong assumptions.
I'm are running an older master checked out at 20150420 with Django v1.5 which I tried to update. I've read the documentation on how to upgrade but it seems not very clear coming from and older version than 1.0. Here are the steps I followed:
manage.py migrate
This will run ok until it will error on 0001_initial (some table already exists).
I converted this file to sql with the following cmd:
manage.py sqlmigrate patchwork 0001_initial
After looking at the generated SQL, it looks I'm only missing the part defined at 015-add-patch-tags.sql so i have manually imported it into my db.
Then looking at my db, I'm also missing all other parts from the following migration scripts, so I generated the missing SQL and imported it into my db.
This ends up in a working upgraded patchwork except runserver complained about some outstanding migration which i resolved by running:
manage.py migrate --fake
Now my question is, is this the correct procedure or did I miss/forget something?
And will I in the future be able to just run:
manage.py migrate
The text was updated successfully, but these errors were encountered: