Skip to content

Commit

Permalink
add mysql changes
Browse files Browse the repository at this point in the history
  • Loading branch information
briancao committed Oct 3, 2022
1 parent adb0a06 commit 6de634f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
11 changes: 11 additions & 0 deletions db/mysql/migrations/04_account_uuid/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- AlterTable
ALTER TABLE `account` ADD COLUMN `account_uuid` VARCHAR(36);

-- Backfill UUID
UPDATE `account` SET account_uuid=(SELECT uuid());

-- AlterTable
ALTER TABLE `account` MODIFY `account_uuid` VARCHAR(36) NOT NULL;

-- CreateIndex
CREATE UNIQUE INDEX `account_account_uuid_key` ON `account`(`account_uuid`);
15 changes: 8 additions & 7 deletions db/mysql/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ datasource db {
}

model account {
user_id Int @id @default(autoincrement()) @db.UnsignedInt
username String @unique() @db.VarChar(255)
password String @db.VarChar(60)
is_admin Boolean @default(false)
created_at DateTime? @default(now()) @db.Timestamp(0)
updated_at DateTime? @default(now()) @db.Timestamp(0)
website website[]
user_id Int @id @default(autoincrement()) @db.UnsignedInt
username String @unique() @db.VarChar(255)
password String @db.VarChar(60)
is_admin Boolean @default(false)
created_at DateTime? @default(now()) @db.Timestamp(0)
updated_at DateTime? @default(now()) @db.Timestamp(0)
account_uuid String @unique() @db.VarChar(36)
website website[]
}

model event {
Expand Down

0 comments on commit 6de634f

Please sign in to comment.