populate created_by in migration script

This commit is contained in:
Francis Cao 2024-02-05 12:09:57 -08:00
parent e5e8d0acc8
commit e915074c4b
2 changed files with 8 additions and 0 deletions

View File

@ -16,6 +16,9 @@ ALTER TABLE `user` ADD COLUMN `display_name` VARCHAR(255) NULL,
ALTER TABLE `website` ADD COLUMN `created_by` VARCHAR(36) NULL,
ADD COLUMN `team_id` VARCHAR(36) NULL;
-- MigrateData
UPDATE "website" SET created_by = user_id WHERE team_id IS NULL;
-- DropTable
DROP TABLE `team_website`;

View File

@ -16,6 +16,9 @@ ADD COLUMN "logo_url" VARCHAR(2183);
ALTER TABLE "website" ADD COLUMN "created_by" UUID,
ADD COLUMN "team_id" UUID;
-- MigrateData
UPDATE "website" SET created_by = user_id WHERE team_id IS NULL;
-- DropTable
DROP TABLE "team_website";
@ -24,3 +27,5 @@ CREATE INDEX "website_team_id_idx" ON "website"("team_id");
-- CreateIndex
CREATE INDEX "website_created_by_idx" ON "website"("created_by");