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

Avoid Status.DoesNotExist during loaddata; document PostgreSQL to MySQL data migration #954

Merged
merged 5 commits into from
Oct 8, 2021

Conversation

glennmatthews
Copy link
Contributor

Fixes: #555

During nautobot-server loaddata, the attempt in Cable.__init__ to cache any pre-existing Status for the cable was throwing an exception because the Status models hadn't been written to the database yet. Since Cable._orig_status is only used in the update_connected_endpoints signal handler for post_save, and only in the case where created == False, we can safely skip setting _orig_status in the case where the Cable is being newly created and doesn't pre-exist in the database.

That's my working theory anyway - this change definitely allows invoke loaddata to run without errors now, but our unit test coverage for this signal path appears pretty close to zero, so please hold me accountable here. :-)

@glennmatthews
Copy link
Contributor Author

Backported #953 to develop so that we can easily use MySQL there for testing. Added notes about setting the MySQL character set and collation explicitly to ensure case-sensitivity and compatibility with Postgres. Add documentation about migrating data from PostgreSQL to MySQL - this could probably be fleshed out more thoroughly but the commands given work in my testing.

@glennmatthews glennmatthews changed the title Avoid Status.DoesNotExist during loaddata Avoid Status.DoesNotExist during loaddata; document PostgreSQL to MySQL data migration Oct 4, 2021
@glennmatthews glennmatthews merged commit 0a15273 into develop Oct 8, 2021
@glennmatthews glennmatthews deleted the gfm-issue-555 branch October 8, 2021 20:33
glennmatthews added a commit that referenced this pull request Oct 8, 2021
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.

invoke loaddata - traceback
2 participants