File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
services/datalake/pod-datalake/src/datalake Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -560,7 +560,7 @@ export function escape (value: any): string {
560
560
}
561
561
562
562
function getMigrations ( ) : [ string , string ] [ ] {
563
- return [ migrationV1 ( ) ]
563
+ return [ migrationV1 ( ) , migrationV2 ( ) ]
564
564
}
565
565
566
566
function migrationV1 ( ) : [ string , string ] {
@@ -599,3 +599,22 @@ function migrationV1 (): [string, string] {
599
599
`
600
600
return [ 'init_tables_01' , sql ]
601
601
}
602
+
603
+ function migrationV2 ( ) : [ string , string ] {
604
+ const sql = `
605
+ ALTER TABLE blob.meta DROP CONSTRAINT IF EXISTS fk_blob;
606
+
607
+ UPDATE blob.blob
608
+ SET workspace = w.uuid
609
+ FROM global_account.workspace w
610
+ WHERE workspace = w.data_id;
611
+
612
+ UPDATE blob.meta
613
+ SET workspace = w.uuid
614
+ FROM global_account.workspace w
615
+ WHERE workspace = w.data_id;
616
+
617
+ ALTER TABLE blob.meta ADD CONSTRAINT fk_blob FOREIGN KEY (workspace, name) REFERENCES blob.blob (workspace, name);
618
+ `
619
+ return [ 'migrate_workspaces_02' , sql ]
620
+ }
You can’t perform that action at this time.
0 commit comments