assetflow/prisma/schema.prisma

68 lines
1.7 KiB
Plaintext
Raw Normal View History

// 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"
output = "../docs"
}
enum Status {
normal
borrowed
stolen
lost
}
model Item {
id Int @id @default(autoincrement())
SKU String? @unique
Amount Int
Comment String?
name String
manufacturer String
category Category @relation(fields: [categoryId], references: [id])
categoryId Int
status Status
StorageLocation StorageLocation? @relation(fields: [storageLocationId], references: [id])
storageLocationId Int?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
importedBy String?
}
model StorageLocation {
id Int @id @default(autoincrement())
name String
storageBuilding StorageBuilding? @relation(fields: [storageBuildingId], references: [id])
storageBuildingId Int?
Item Item[]
}
model StorageBuilding {
id Int @id @default(autoincrement())
name String
street String
houseNumber String
zipCode String
city String
country String
StorageLocation StorageLocation[]
}
model Category {
id Int @id @default(autoincrement())
name String @unique
description String?
Item Item[]
}