File tree 3 files changed +65
-0
lines changed
3 files changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ -- CreateTable
2
+ CREATE TABLE "Customer " (
3
+ " id" TEXT NOT NULL ,
4
+ " email" VARCHAR (255 ) NOT NULL ,
5
+ " name" VARCHAR (50 ) NOT NULL ,
6
+ " hashPassword" VARCHAR (64 ) NOT NULL ,
7
+ " createdAt" TIMESTAMP (3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ,
8
+ " updatedAt" TIMESTAMP (3 ) NOT NULL ,
9
+
10
+ CONSTRAINT " Customer_pkey" PRIMARY KEY (" id" )
11
+ );
12
+
13
+ -- CreateTable
14
+ CREATE TABLE "Product " (
15
+ " id" SERIAL NOT NULL ,
16
+ " title" VARCHAR (50 ) NOT NULL ,
17
+ " content" TEXT NOT NULL ,
18
+ " price" DOUBLE PRECISION NOT NULL ,
19
+ " createAt" TIMESTAMP (3 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ,
20
+ " updateAt" TIMESTAMP (3 ) NOT NULL ,
21
+ " ownerId" TEXT ,
22
+
23
+ CONSTRAINT " Product_pkey" PRIMARY KEY (" id" )
24
+ );
25
+
26
+ -- CreateIndex
27
+ CREATE UNIQUE INDEX "Customer_email_key " ON " Customer" (" email" );
28
+
29
+ -- AddForeignKey
30
+ ALTER TABLE " Product" ADD CONSTRAINT " Product_ownerId_fkey" FOREIGN KEY (" ownerId" ) REFERENCES " Customer" (" id" ) ON DELETE SET NULL ON UPDATE CASCADE;
Original file line number Diff line number Diff line change
1
+ # Please do not edit this file manually
2
+ # It should be added in your version-control system (i.e. Git)
3
+ provider = " postgresql"
Original file line number Diff line number Diff line change
1
+ // This is your Prisma schema file,
2
+ // learn more about it in the docs: https://pris.ly/d/prisma-schema
3
+
4
+ generator client {
5
+ provider = " prisma-client-js "
6
+ }
7
+
8
+ datasource db {
9
+ provider = " postgresql "
10
+ url = env (" DATABASE_URL " )
11
+ }
12
+
13
+ model Customer {
14
+ id String @id @default (uuid () )
15
+ email String @unique @db.VarChar (255 )
16
+ name String @db.VarChar (50 )
17
+ hashPassword String @db.VarChar (64 )
18
+ createdAt DateTime @default (now () )
19
+ updatedAt DateTime @updatedAt
20
+ products Product []
21
+ }
22
+
23
+ model Product {
24
+ id Int @id @default (autoincrement () )
25
+ title String @db.VarChar (50 )
26
+ content String
27
+ price Float
28
+ createAt DateTime @default (now () )
29
+ updateAt DateTime @updatedAt
30
+ owner Customer ? @relation (fields : [ownerId ] , references : [id ] )
31
+ ownerId String ?
32
+ }
You can’t perform that action at this time.
0 commit comments