Skip to content

Commit

Permalink
Update schema.prisma with DateTime nullable fields
Browse files Browse the repository at this point in the history
  • Loading branch information
assafnoahkoren committed Nov 20, 2023
1 parent 75f32b4 commit fc4e836
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- AlterTable
ALTER TABLE "Business" ALTER COLUMN "updated_at" DROP NOT NULL;

-- AlterTable
ALTER TABLE "BusinessProduct" ALTER COLUMN "updated_at" DROP NOT NULL;

-- AlterTable
ALTER TABLE "Category" ALTER COLUMN "updated_at" DROP NOT NULL;

-- AlterTable
ALTER TABLE "Certificate" ALTER COLUMN "updated_at" DROP NOT NULL;

-- AlterTable
ALTER TABLE "CertificateCategory" ALTER COLUMN "updated_at" DROP NOT NULL;

-- AlterTable
ALTER TABLE "CertificateClaim" ALTER COLUMN "updated_at" DROP NOT NULL;

-- AlterTable
ALTER TABLE "Order" ALTER COLUMN "updated_at" DROP NOT NULL;

-- AlterTable
ALTER TABLE "Product" ALTER COLUMN "updated_at" DROP NOT NULL;

-- AlterTable
ALTER TABLE "Profile" ALTER COLUMN "updated_at" DROP NOT NULL;

-- AlterTable
ALTER TABLE "Transaction" ALTER COLUMN "updated_at" DROP NOT NULL;

-- AlterTable
ALTER TABLE "TransactionReview" ALTER COLUMN "updated_at" DROP NOT NULL;
34 changes: 17 additions & 17 deletions services/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ datasource db {
}

model Profile {
id Int @id @default(autoincrement())
id Int @id @default(autoincrement())
first_name String?
last_name String?
phone String?
created_at DateTime @default(now())
updated_at DateTime @updatedAt
created_at DateTime @default(now())
updated_at DateTime? @updatedAt
}

model Business {
Expand All @@ -25,20 +25,20 @@ model Business {
address String
phone String
created_at DateTime @default(now())
updated_at DateTime @updatedAt
updated_at DateTime? @updatedAt
BusinessProduct BusinessProduct[]
Order Order[]
CertificateClaim CertificateClaim[]
}

model BusinessProduct {
id Int @id @default(autoincrement())
business Business @relation(fields: [business_id], references: [id])
id Int @id @default(autoincrement())
business Business @relation(fields: [business_id], references: [id])
business_id Int
product Product @relation(fields: [product_id], references: [id])
product Product @relation(fields: [product_id], references: [id])
product_id Int
created_at DateTime @default(now())
updated_at DateTime @updatedAt
created_at DateTime @default(now())
updated_at DateTime? @updatedAt
}

model Product {
Expand All @@ -49,7 +49,7 @@ model Product {
category_id Int
category Category @relation(fields: [category_id], references: [id])
created_at DateTime @default(now())
updated_at DateTime @updatedAt
updated_at DateTime? @updatedAt
BusinessProduct BusinessProduct[]
Order Order[]
}
Expand All @@ -58,7 +58,7 @@ model Category {
id Int @id @default(autoincrement())
name String
created_at DateTime @default(now())
updated_at DateTime @updatedAt
updated_at DateTime? @updatedAt
Product Product[]
}

Expand All @@ -79,7 +79,7 @@ model Order {
price_per_unit Float?
quantity_by_units Float
created_at DateTime @default(now())
updated_at DateTime @updatedAt
updated_at DateTime? @updatedAt
buy_transaction Transaction[] @relation("buy_order")
sell_transaction Transaction[] @relation("sell_order")
}
Expand All @@ -101,7 +101,7 @@ model Transaction {
status TransactionStatus
profile_id Int
created_at DateTime @default(now())
updated_at DateTime @updatedAt
updated_at DateTime? @updatedAt
TransactionReview TransactionReview[]
}
Expand All @@ -113,7 +113,7 @@ model TransactionReview {
rating Int
comment String
created_at DateTime @default(now())
updated_at DateTime @updatedAt
updated_at DateTime? @updatedAt
}

model Certificate {
Expand All @@ -122,7 +122,7 @@ model Certificate {
image_url String?
icon_url String?
created_at DateTime @default(now())
updated_at DateTime @updatedAt
updated_at DateTime? @updatedAt
CertificateClaim CertificateClaim[]
CertificateCategory CertificateCategory? @relation(fields: [certificateCategory_id], references: [id])
certificateCategory_id Int?
Expand All @@ -132,7 +132,7 @@ model CertificateCategory {
id Int @id @default(autoincrement())
name String
created_at DateTime @default(now())
updated_at DateTime @updatedAt
updated_at DateTime? @updatedAt
Certificate Certificate[]
}

Expand All @@ -150,5 +150,5 @@ model CertificateClaim {
business Business @relation(fields: [business_id], references: [id])
status CertificateClaimStatus
created_at DateTime @default(now())
updated_at DateTime @updatedAt
updated_at DateTime? @updatedAt
}

0 comments on commit fc4e836

Please sign in to comment.