-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated Appuser primary key type (#329)
- Loading branch information
Showing
3 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Migration } from '@mikro-orm/migrations'; | ||
|
||
export class Migration20240818015511 extends Migration { | ||
|
||
override async up(): Promise<void> { | ||
this.addSql('alter table "app_user_organization_role" drop constraint "app_user_organization_role_app_user_id_foreign";'); | ||
|
||
this.addSql('alter table "app_user" alter column "id" drop default;'); | ||
this.addSql('alter table "app_user" alter column "id" type uuid using ("id"::text::uuid);'); | ||
|
||
this.addSql('alter table "app_user_organization_role" alter column "app_user_id" drop default;'); | ||
this.addSql('alter table "app_user_organization_role" alter column "app_user_id" type uuid using ("app_user_id"::text::uuid);'); | ||
this.addSql('alter table "app_user_organization_role" add constraint "app_user_organization_role_app_user_id_foreign" foreign key ("app_user_id") references "app_user" ("id") on delete cascade;'); | ||
} | ||
|
||
override async down(): Promise<void> { | ||
this.addSql('alter table "app_user" alter column "id" type text using ("id"::text);'); | ||
|
||
this.addSql('alter table "app_user_organization_role" alter column "app_user_id" type text using ("app_user_id"::text);'); | ||
|
||
this.addSql('alter table "app_user_organization_role" drop constraint "app_user_organization_role_app_user_id_foreign";'); | ||
|
||
this.addSql('alter table "app_user" alter column "id" type char(254) using ("id"::char(254));'); | ||
|
||
this.addSql('alter table "app_user_organization_role" alter column "app_user_id" type char(254) using ("app_user_id"::char(254));'); | ||
this.addSql('alter table "app_user_organization_role" add constraint "app_user_organization_role_app_user_id_foreign" foreign key ("app_user_id") references "app_user" ("id") on delete cascade;'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters