mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 11:01:54 +03:00
Qfix: final account migration adjustments (#6801)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
eb66c36892
commit
e09a24cbc1
@ -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)
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user