summaryrefslogtreecommitdiff
path: root/prisma/schema.prisma
diff options
context:
space:
mode:
Diffstat (limited to 'prisma/schema.prisma')
-rw-r--r--prisma/schema.prisma70
1 files changed, 70 insertions, 0 deletions
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
new file mode 100644
index 0000000..a37f63c
--- /dev/null
+++ b/prisma/schema.prisma
@@ -0,0 +1,70 @@
+generator client {
+ provider = "prisma-client-js"
+}
+
+datasource db {
+ provider = "mysql"
+ url = env("DATABASE_URL")
+}
+
+model Company {
+ id Int @id @default(autoincrement())
+ name String
+ users User[]
+ locations Location[]
+ products Product[]
+ stockOpnames StockOpname[]
+}
+
+model User {
+ id Int @id @default(autoincrement())
+ name String
+ company Company @relation(fields: [companyId], references: [id])
+ companyId Int
+ username String @unique
+ password String
+ stockOpnames StockOpname[]
+ team Team
+}
+
+model Location {
+ id Int @id @default(autoincrement())
+ name String
+ company Company @relation(fields: [companyId], references: [id])
+ companyId Int
+ stockOpnames StockOpname[]
+}
+
+model Product {
+ id Int @id @default(autoincrement())
+ barcode String
+ itemCode String
+ name String
+ onhandQty Int
+ differenceQty Int
+ isDifferent Boolean
+ company Company @relation(fields: [companyId], references: [id])
+ companyId Int
+ stockOpnames StockOpname[]
+}
+
+model StockOpname {
+ id Int @id @default(autoincrement())
+ product Product @relation(fields: [productId], references: [id])
+ productId Int
+ location Location @relation(fields: [locationId], references: [id])
+ locationId Int
+ company Company @relation(fields: [companyId], references: [id])
+ companyId Int
+ user User @relation(fields: [userId], references: [id])
+ userId Int
+ team Team
+ quantity Int
+ isDifferent Boolean
+}
+
+enum Team {
+ COUNT1
+ COUNT2
+ VERIFICATION
+}