mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-09 09:20:54 +00:00
UBERF-11178 Migrate datalake workspace id
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
0c8c2cc84e
commit
75d172e6c1
@ -560,7 +560,7 @@ export function escape (value: any): string {
|
||||
}
|
||||
|
||||
function getMigrations (): [string, string][] {
|
||||
return [migrationV1()]
|
||||
return [migrationV1(), migrationV2()]
|
||||
}
|
||||
|
||||
function migrationV1 (): [string, string] {
|
||||
@ -599,3 +599,22 @@ function migrationV1 (): [string, string] {
|
||||
`
|
||||
return ['init_tables_01', sql]
|
||||
}
|
||||
|
||||
function migrationV2 (): [string, string] {
|
||||
const sql = `
|
||||
ALTER TABLE blob.meta DROP CONSTRAINT IF EXISTS fk_blob;
|
||||
|
||||
UPDATE blob.blob
|
||||
SET workspace = w.uuid
|
||||
FROM global_account.workspace w
|
||||
WHERE workspace = w.data_id;
|
||||
|
||||
UPDATE blob.meta
|
||||
SET workspace = w.uuid
|
||||
FROM global_account.workspace w
|
||||
WHERE workspace = w.data_id;
|
||||
|
||||
ALTER TABLE blob.meta ADD CONSTRAINT fk_blob FOREIGN KEY (workspace, name) REFERENCES blob.blob (workspace, name);
|
||||
`
|
||||
return ['migrate_workspaces_02', sql]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user