From 36880c298c5c0a936b636471fb09f2d9aa7451c2 Mon Sep 17 00:00:00 2001 From: Kirill Date: Wed, 20 May 2026 10:39:01 +0500 Subject: [PATCH] =?UTF-8?q?feat:=20rename=20User.name=E2=86=92displayName,?= =?UTF-8?q?=20add=20firstName/lastName/gender/avatar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migration.sql | 28 +++++++++++++++++++ server/prisma/schema.prisma | 6 +++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 server/prisma/migrations/20260520053830_rename_user_name_to_display_name_add_fields/migration.sql diff --git a/server/prisma/migrations/20260520053830_rename_user_name_to_display_name_add_fields/migration.sql b/server/prisma/migrations/20260520053830_rename_user_name_to_display_name_add_fields/migration.sql new file mode 100644 index 0000000..23ac31e --- /dev/null +++ b/server/prisma/migrations/20260520053830_rename_user_name_to_display_name_add_fields/migration.sql @@ -0,0 +1,28 @@ +/* + Warnings: + + - You are about to drop the column `name` on the `User` table. All the data in the column will be lost. + +*/ +-- RedefineTables +PRAGMA defer_foreign_keys=ON; +PRAGMA foreign_keys=OFF; +CREATE TABLE "new_User" ( + "id" TEXT NOT NULL PRIMARY KEY, + "email" TEXT NOT NULL, + "displayName" TEXT, + "firstName" TEXT, + "lastName" TEXT, + "gender" TEXT, + "avatar" TEXT, + "phone" TEXT, + "passwordHash" TEXT, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL +); +INSERT INTO "new_User" ("createdAt", "email", "id", "passwordHash", "phone", "updatedAt") SELECT "createdAt", "email", "id", "passwordHash", "phone", "updatedAt" FROM "User"; +DROP TABLE "User"; +ALTER TABLE "new_User" RENAME TO "User"; +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); +PRAGMA foreign_keys=ON; +PRAGMA defer_foreign_keys=OFF; diff --git a/server/prisma/schema.prisma b/server/prisma/schema.prisma index c2c6a83..5403c8c 100644 --- a/server/prisma/schema.prisma +++ b/server/prisma/schema.prisma @@ -77,7 +77,11 @@ model CatalogSliderSlide { model User { id String @id @default(cuid()) email String @unique - name String? + displayName String? + firstName String? + lastName String? + gender String? + avatar String? phone String? passwordHash String? createdAt DateTime @default(now())