-
Notifications
You must be signed in to change notification settings - Fork 8
Closes #1: Enable branch migrations #264
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
base: feature
Are you sure you want to change the base?
Conversation
ba98492
to
57eaec2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions on it during test:
- Any branch created before having branching 0.5.6 cannot be migrated?
- If you are on an older version of NetBox 4.1.9 and you upgrade branching to 0.5.6 then you upgrade NetBox to 4.2 and make changes on the branch, then update to NetBox 4.3 and more changes to the branch then upgrade to this PR and do the branch migration - should that still be valid?
- The branch in the list shows as Ready before you run the branch migration, it also shows in the dropdown as "{name} (Ready)" but grayed - should we make that show a different status (Pending Migration) or something as it isn't really ready?
I got a weird crash and I think it was because I still had the browser window open to the branch pre-update. I.E.
- install old NetBox
- create. branch and make changes
- make sure you have the branch active and keep the browser window open
- Update NetBox, update branching to this PR and run migrate
- Go to your open browser window and refresh or try to go to any page - get errors that database fields don't exist.
- Open up new browser (will be in main branch) - go to branches and run the branch migrations.
- After branch is migrated, go back to original browser and refresh, everything works.
Any branch can be migrated, but v0.5.6 of the plugin must be installed before upgrading NetBox.
Yes, that should be supported. However, NetBox v4.3.2 or later is necessary to enable migrating branches.
Its status is technically "ready" however the branch is not available for use due pending migrations. We could introduce an explicit status for this, however I'm not sure how we'd reliably update the branch's status to it. |
This is because the non-migrated branch is still active in the session, so NetBox is trying to access a schema from a previous version. We need to check in middleware that the branch doesn't have any pending migrations before activating it for the request. |
Closes: #1
applied_migrations
ArrayField on Branch to record schema migrations which have been applied to the branchallow_migrate()
method on our custom database router to suppress migrations of models which do not support branchingmigrate()
method on Branch & add supporting UI viewapply()
andundo()
methods on our proxy model for ObjectChange now take a Branch instance as the first argumentmigrate()
method on ObjectChange to automatically adapt pre- and post-change data according to the applicable migrators