-
Notifications
You must be signed in to change notification settings - Fork 39
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
Migrate existing data to new schema on startup #98
Conversation
that was easier than expected!
or else we can't enforce non-null user ids in this table
|
||
_, err = txn.Exec(` | ||
ALTER TABLE syncv3_to_device_ack_pos | ||
ALTER COLUMN user_id SET NOT NULL, |
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.
The cleanup for syncv3_to_device_ack_pos above ensures that this ALTER COLUMN succeeds.
(Though idk if we want to keep this around)
cmd/testmigration/main.go
Outdated
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.
It may be useful to keep this around---this gives us a way to run the migration manually without having to startup the proxy proper.
I'm going to merge this as it is. I would like to spend a little more time seeing if there are any easy speedups, to minimise downtime. ATM the slowest parts are updating the to_device table. There are occasionally slow /whoami responses too. |
Tested sucessfully against an isolated backup of the m.org proxy deployment. (Circa 5 minutes to run and commit.)
I would like to write a few test cases (see #89 (comment)) before closing #89 and #51.