Skip to content

Commit 511ba59

Browse files
committed
feat: add accountName field to User model
1 parent 2c7cd9b commit 511ba59

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
Warnings:
3+
4+
- A unique constraint covering the columns `[account_name]` on the table `users` will be added. If there are existing duplicate values, this will fail.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "users" ADD COLUMN "account_name" TEXT NOT NULL DEFAULT gen_random_uuid();
9+
10+
-- CreateIndex
11+
CREATE UNIQUE INDEX "users_account_name_key" ON "users"("account_name");

packages/db-main-prisma/prisma/postgres/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ model User {
181181
salt String?
182182
phone String? @unique
183183
email String @unique
184+
accountName String @default(uuid()) @unique @map("account_name")
184185
avatar String?
185186
isSystem Boolean? @map("is_system")
186187
isAdmin Boolean? @map("is_admin")
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/*
2+
Warnings:
3+
4+
- A unique constraint covering the columns `[account_name]` on the table `users` will be added. If there are existing duplicate values, this will fail.
5+
6+
*/
7+
-- AlterTable
8+
ALTER TABLE "users" ADD COLUMN "account_name" TEXT NOT NULL DEFAULT (lower(hex(randomblob(16))));
9+
10+
-- CreateIndex
11+
CREATE UNIQUE INDEX "users_account_name_key" ON "users"("account_name");

packages/db-main-prisma/prisma/sqlite/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ model User {
181181
salt String?
182182
phone String? @unique
183183
email String @unique
184+
accountName String @default(uuid()) @unique @map("account_name")
184185
avatar String?
185186
isSystem Boolean? @map("is_system")
186187
isAdmin Boolean? @map("is_admin")

packages/db-main-prisma/prisma/template.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ model User {
181181
salt String?
182182
phone String? @unique
183183
email String @unique
184+
accountName String @default(uuid()) @unique @map("account_name")
184185
avatar String?
185186
isSystem Boolean? @map("is_system")
186187
isAdmin Boolean? @map("is_admin")

0 commit comments

Comments
 (0)