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

Broken migrations to 0.9.0a1 #153

Open
DNX opened this issue Jul 27, 2014 · 4 comments
Open

Broken migrations to 0.9.0a1 #153

DNX opened this issue Jul 27, 2014 · 4 comments

Comments

@DNX
Copy link
Contributor

DNX commented Jul 27, 2014

If you install and "initiate" from scratch django-lfs==0.7 then you'are not able to migrate it to 0.9.0a1, you'll receive a lot of errors in migrate_to_09 def:

django.db.utils.OperationalError: no such column: customer_customer.sa_content_type_id
and...
TypeError: 'NoneType' object has no attribute 'getitem'
and...
django.db.utils.OperationalError: no such table: core_application
and...
django.db.utils.IntegrityError: null value in column "price" violates not-null constraint
and so on...
have anyone tested these migrations at least once?

@pigletto
Copy link
Collaborator

How do you test it?

Anyway, I've tried to migrate db from lfs 0.7 to latest tip and get some errors about "django.db.utils.OperationalError: no such column: customer_customer.dsa_object_id".

I did it by installing lfs-buildout-development and migrating lfs.db (sqlite) from lfs 0.7 install.
Not sure why there is such errors. Possibly something has changed between django 1.4 and 1.6.

Migrations were tested but when it was still using django 1.4.

@DNX
Copy link
Contributor Author

DNX commented Jul 27, 2014

I tried also to migrate my "production" postgres db, but here I ran in other errors like:

django.db.utils.IntegrityError: duplicate key value violates unique constraint "addresses_baseaddress_pkey"
DETAIL: Key (id)=(1) already exists.

I added in migrate_to_09 def:
cursor.execute("SELECT setval('addresses_baseaddress_id_seq', (SELECT MAX(id) FROM addresses_baseaddress)+1)")

then I received other errors again. There are also some conflicts with the models in 0.9.0a1 in some fields which must be created after by migrations(South).

@pigletto
Copy link
Collaborator

I've found that removal of stale content types during run of 'migrate' command caused some errors during migration (ones about not existing columns). I've added a 'interactive=False' to the call to migrate command to fix it and migration works for me with sqlite db now.
Another option is to answer 'no' when asked to remove content types.

I've not been able to reproduce sequence problem but haven't tried it with postgres. If

cursor.execute("SELECT setval('addresses_baseaddress_id_seq', (SELECT MAX(id) FROM addresses_baseaddress)+1)")

fixes it then please provide a pull request or at least a line number where it should be inserted.

@DNX
Copy link
Contributor Author

DNX commented Aug 25, 2014

Ok Maciej, I'll test it with my postgress db with my production data and
then will post here the results.

On Mon, Aug 25, 2014 at 10:13 PM, Maciej Wiśniowski <
[email protected]> wrote:

I've found that removal of stale content types during run of 'migrate'
command caused some errors during migration (ones about not existing
columns). I've added a 'interactive=False' to the call to migrate command
to fix it and migration works for me with sqlite db now.
Another option is to answer 'no' when asked to remove content types.

I've not been able to reproduce sequence problem but haven't tried it with
postgres. If

cursor.execute("SELECT setval('addresses_baseaddress_id_seq', (SELECT
MAX(id) FROM addresses_baseaddress)+1)")

fixes it then please provide a pull request or at least a line number
where it should be inserted.


Reply to this email directly or view it on GitHub
#153 (comment)
.

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