-
Notifications
You must be signed in to change notification settings - Fork 96
AuthDO schema migration refinements #515
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
storage, | ||
lc, | ||
storageSchemaMeta, | ||
STORAGE_SCHEMA_VERSION, |
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.
Okay, I see now.
In that case, I think it would be safer to specify the actual version number in these calls (i.e. 1
instead of STORAGE_SCHEMA_VERSION
), so that when subsequent migration steps steps are added, the previous steps don't need to be changed.
Then we would add a check in migrate...()
that the version <= STORAGE_SCHEMA_VERSION
.
wdyt?
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.
Great suggestion. Done.
a92bf77
to
71c4c6b
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.
LGTM
this._initRoutes(); | ||
this._lc.info?.('Starting server'); | ||
this._lc.info?.('Version:', version); | ||
void state.blockConcurrencyWhile(() => |
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.
.catch would be better and log the error if any.
minSafeRollbackVersion: number; | ||
}; | ||
|
||
async function migrateStorageSchemaToVersion( |
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.
Does it make sense to move this to another file? This file is getting large.
(await storage.get(AUTH_DO_STORAGE_SCHEMA_VERSION_KEY)) ?? 0; | ||
if (storageSchemaVersion >= AUTH_DO_STORAGE_SCHEMA_VERSION) { | ||
return; | ||
lc.addContext('SchemaUpdate'); |
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.
lc = lc.addContext
storage, | ||
CONNECTION_KEY_PREFIX, | ||
)) { | ||
await storage.delete(connectionKeyString); |
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.
Would it be worth using multi delete here and below?
Update AuthDO schema migration logic to deal with down-migrates (i.e. dealing with rolling back a deploy that does a migration).
Also address arv's feedback from #491