2023-04-30 22:04:13 +02:00
|
|
|
// This is your Prisma schema file,
|
|
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
|
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "mysql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
2023-05-06 20:30:32 +02:00
|
|
|
// https://github.com/pantharshit00/prisma-docs-generator
|
|
|
|
generator docs {
|
|
|
|
provider = "node node_modules/prisma-docs-generator"
|
2023-05-12 23:57:21 +02:00
|
|
|
output = "../docs"
|
2023-05-06 20:30:32 +02:00
|
|
|
}
|
|
|
|
|
2023-05-06 20:48:58 +02:00
|
|
|
// https://github.com/notiz-dev/prisma-dbml-generator
|
|
|
|
// Viewer: https://dbdiagram.io/d
|
|
|
|
generator dbml {
|
2023-05-12 23:57:21 +02:00
|
|
|
provider = "prisma-dbml-generator"
|
|
|
|
output = "../docs"
|
2023-05-06 20:48:58 +02:00
|
|
|
outputName = "schema.dbml"
|
|
|
|
projectName = "AssetFlow"
|
|
|
|
}
|
|
|
|
|
2023-04-30 22:04:13 +02:00
|
|
|
enum Status {
|
|
|
|
normal
|
|
|
|
borrowed
|
|
|
|
stolen
|
|
|
|
lost
|
|
|
|
}
|
|
|
|
|
|
|
|
model Item {
|
2023-05-01 22:15:35 +02:00
|
|
|
id Int @id @default(autoincrement())
|
2023-05-12 23:57:21 +02:00
|
|
|
SKU String? @unique
|
2023-04-30 22:04:13 +02:00
|
|
|
Amount Int
|
|
|
|
Comment String?
|
|
|
|
name String
|
|
|
|
manufacturer String
|
2023-05-01 22:15:35 +02:00
|
|
|
category Category @relation(fields: [categoryId], references: [id])
|
|
|
|
categoryId Int
|
2023-04-30 22:04:13 +02:00
|
|
|
status Status
|
2023-05-01 18:36:24 +02:00
|
|
|
StorageLocation StorageLocation? @relation(fields: [storageLocationId], references: [id])
|
|
|
|
storageLocationId Int?
|
2023-05-01 22:15:35 +02:00
|
|
|
createdAt DateTime @default(now())
|
|
|
|
updatedAt DateTime @updatedAt
|
2023-05-02 18:23:47 +02:00
|
|
|
importedBy String?
|
2023-04-30 22:04:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model StorageLocation {
|
2023-05-12 23:57:21 +02:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String @unique
|
|
|
|
storageUnit StorageUnit? @relation(fields: [storageUnitId], references: [id])
|
|
|
|
storageUnitId Int?
|
|
|
|
Item Item[]
|
2023-04-30 22:04:13 +02:00
|
|
|
}
|
|
|
|
|
2023-05-12 23:57:21 +02:00
|
|
|
model StorageUnit {
|
2023-04-30 22:04:13 +02:00
|
|
|
id Int @id @default(autoincrement())
|
|
|
|
name String
|
|
|
|
street String
|
|
|
|
houseNumber String
|
|
|
|
zipCode String
|
|
|
|
city String
|
|
|
|
country String
|
|
|
|
StorageLocation StorageLocation[]
|
|
|
|
}
|
2023-05-01 22:15:35 +02:00
|
|
|
|
|
|
|
model Category {
|
|
|
|
id Int @id @default(autoincrement())
|
2023-05-12 23:57:21 +02:00
|
|
|
name String @unique
|
2023-05-01 22:15:35 +02:00
|
|
|
description String?
|
|
|
|
Item Item[]
|
|
|
|
}
|