base commit

This commit is contained in:
@kirill.komarov
2026-04-29 18:34:25 +05:00
parent f6b6959268
commit 326521c9e6
20 changed files with 1825 additions and 36 deletions
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "phone" TEXT;
@@ -0,0 +1,22 @@
-- CreateTable
CREATE TABLE "ShippingAddress" (
"id" TEXT NOT NULL PRIMARY KEY,
"label" TEXT,
"recipientName" TEXT NOT NULL,
"recipientPhone" TEXT NOT NULL,
"addressLine" TEXT NOT NULL,
"comment" TEXT,
"lat" REAL NOT NULL,
"lng" REAL NOT NULL,
"isDefault" BOOLEAN NOT NULL DEFAULT false,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"userId" TEXT NOT NULL,
CONSTRAINT "ShippingAddress_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateIndex
CREATE INDEX "ShippingAddress_userId_isDefault_idx" ON "ShippingAddress"("userId", "isDefault");
-- CreateIndex
CREATE INDEX "ShippingAddress_userId_updatedAt_idx" ON "ShippingAddress"("userId", "updatedAt");
+22
View File
@@ -56,11 +56,33 @@ model User {
id String @id @default(cuid())
email String @unique
name String?
phone String?
passwordHash String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
codes AuthCode[]
addresses ShippingAddress[]
}
model ShippingAddress {
id String @id @default(cuid())
label String?
recipientName String
recipientPhone String
addressLine String
comment String?
lat Float
lng Float
isDefault Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String
@@index([userId, isDefault])
@@index([userId, updatedAt])
}
model AuthCode {