Skip to content

fix django 1.11 migrations#2212

Merged
giovannipizzi merged 9 commits into
aiidateam:provenance_redesignfrom
ltalirz:try-charfield
Nov 17, 2018
Merged

fix django 1.11 migrations#2212
giovannipizzi merged 9 commits into
aiidateam:provenance_redesignfrom
ltalirz:try-charfield

Conversation

@ltalirz
Copy link
Copy Markdown
Member

@ltalirz ltalirz commented Nov 17, 2018

  • update django settings (cleanup + adaptation to django 1.11) together with @giovannipizzi
  • fix migration of UUID column for databases created with previous schema versions
  • make sure we give unicode strings to django (not byte strings)
  • add test to check that uuid migration does not change uuids
  • add test to check that no django schema migrations remain

Will look into adding sqlalchemy unique constraints on uuid column in a separate PR

update django settings together with @giovannipizzi
to be conformant with django 1.11
the migration was missing the transformation of dbnode
(affects only migration of older databases)
for consistency, start with CharField with uuid (as in UUID field of
django_extensions) and only afterwards migrate to django UUIDField
to check: is the same true for python2?
add test to check that no django schema migrations remain
@coveralls
Copy link
Copy Markdown

coveralls commented Nov 17, 2018

Coverage Status

Coverage increased (+0.03%) to 68.851% when pulling f43ea24 on ltalirz:try-charfield into 7e7f062 on aiidateam:provenance_redesign.

@sphuber
Copy link
Copy Markdown
Contributor

sphuber commented Nov 17, 2018

Will this fix the origin of the tests failing now in Django? Get a lot of errors in SQL where its trying to compare uuid types to varchars, telling me we should cast the values. And if that is so, how did that pass the checks before merging?

@ltalirz
Copy link
Copy Markdown
Member Author

ltalirz commented Nov 17, 2018

Get a lot of errors in SQL where its trying to compare uuid types to varchars, telling me we should cast the values.

Are you talking about tests on travis or tests run locally?
Locally, yes: if you did not create your database from scratch, then this would happen (sorry for this; was the first time for me editing the db schema). Merging the PR will not fix this, since the (flawed) migration has already been applied (you'll need to create a new test database)
On travis: I would not understand why you get problems there...

@giovannipizzi giovannipizzi merged commit aa79072 into aiidateam:provenance_redesign Nov 17, 2018
@sphuber
Copy link
Copy Markdown
Contributor

sphuber commented Nov 17, 2018

Ah yeah you are right, that was the problem. After dropping and recreating the database it is fine

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

Successfully merging this pull request may close these issues.

4 participants