Skip to content

Commit

Permalink
added new migration
Browse files Browse the repository at this point in the history
  • Loading branch information
flippedcoder committed Oct 7, 2023
1 parent 3b04579 commit 6c13ea2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 3,7 @@ CREATE TABLE "User" (
"id" SERIAL NOT NULL,
"email" TEXT NOT NULL,
"name" TEXT NOT NULL,
"permissions" TEXT[],

CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
Expand All @@ -12,7 13,7 @@ CREATE TABLE "Product" (
"id" TEXT NOT NULL,
"name" TEXT NOT NULL,
"price" DOUBLE PRECISION NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "Product_pkey" PRIMARY KEY ("id")
Expand All @@ -23,7 24,7 @@ CREATE TABLE "Order" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"total" DOUBLE PRECISION NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"userId" INTEGER,

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 1,8 @@
/*
Warnings:
- Added the required column `stripeProductId` to the `Product` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Product" ADD COLUMN "stripeProductId" TEXT NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 1,8 @@
/*
Warnings:
- Added the required column `stripeInvoiceId` to the `Order` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Order" ADD COLUMN "stripeInvoiceId" TEXT NOT NULL;
30 changes: 16 additions & 14 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 19,23 @@ model User {
}

model Product {
id String @id @default(uuid())
name String
price Float
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
orders Order[]
id String @id @default(uuid())
name String
price Float
stripeProductId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
orders Order[]
}

model Order {
id Int @id @default(autoincrement())
name String
total Float
products Product[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId Int?
User User? @relation(fields: [userId], references: [id])
id Int @id @default(autoincrement())
stripeInvoiceId String
name String
total Float
products Product[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId Int?
User User? @relation(fields: [userId], references: [id])
}

0 comments on commit 6c13ea2

Please sign in to comment.