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

Qfix: Final account migration tool adjustments #6801

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions dev/tool/src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,20 @@ export async function moveAccountDbFromMongoToPG (

delete (pgAccount as any).workspaces

if (pgAccount.createdOn === undefined) {
if (pgAccount.createdOn == null) {
pgAccount.createdOn = Date.now()
}

for (const workspace of mongoAccount.workspaces) {
workspaceAssignments.push([pgAccount._id, workspace.toString()])
if (pgAccount.first == null) {
pgAccount.first = 'NotSet'
}

if (pgAccount.last == null) {
pgAccount.last = 'NotSet'
}

for (const workspaceString of new Set(mongoAccount.workspaces.map((w) => w.toString()))) {
workspaceAssignments.push([pgAccount._id, workspaceString])
}

const exists = await getAccount(pgDb, pgAccount.email)
Expand All @@ -175,6 +183,10 @@ export async function moveAccountDbFromMongoToPG (
_id: mongoWorkspace._id.toString()
}

if (pgWorkspace.createdOn == null) {
pgWorkspace.createdOn = Date.now()
}

// delete deprecated fields
delete (pgWorkspace as any).createProgress
delete (pgWorkspace as any).creating
Expand Down
Loading