pierwsza wersja db scheme

This commit is contained in:
2026-04-22 20:49:14 +02:00
parent 5361806f34
commit e14dc42689

118
db_schema Normal file
View File

@@ -0,0 +1,118 @@
// Use DBML to define your database structure
// Docs: https://dbml.dbdiagram.io/docs
Table models {
id int [pk]
name varchar [not null, unique]
strings int [not null, default: 6, note: "ilosc strun"]
scale int [not null, default: 645, note: "menzura w mm"]
}
Table colors {
id int [pk]
name varchar [not null, unique]
burst bool [not null, default: false, note: "czy ma cien"]
monolith bool [not null, default: false, note: "czy nie jest transparetny"]
}
Enum finish_type {
GLOSS
SATIN
MAT
NITRO
}
Table products {
id int [pk]
order_code varchar [not null, unique, note: "pelny nr zamowinia w formie tekstowej XXXX/YYYY/ZZ"]
model int [ref: > models.id, not null]
color_body_top int [ref: > colors.id, not null]
color_body_back int [ref: > colors.id, not null]
color_neck_top int [ref: > colors.id, null, default: null]
color_neck_back int [ref: > colors.id, null, default: null]
finish_body_top finish_type [not null]
finish_body_back finish_type [not null]
finish_neck_top finish_type [null, default: null]
finish_neck_back finish_type [null, default: null]
note text
}
Table detail_products {
id int [pk]
product_id int [ref: - products.id, not null]
spec text [note: "specyfikacja pobrana ze starego systemu w formie json"]
url varchar [note: "adres url strony ze specyfikacja ze starego systemu" ]
}
Table clients {
id int [pk]
name varchar [not null, note: "Nazwa klienta"]
country varchar [note: "Kraj klienta"]
}
Table orders {
id int [pk]
order_number int [not null, note: "XXXX, eg 0027"]
order_year int [not null, note: "YYYY, eg 2025"]
client_id int [ref: > clients.id ,not null]
indexes {
(order_number, order_year) [unique]
}
}
Table order_products {
id int [pk]
product_id int [ref: > products.id, not null]
order_id int [ref: > orders.id, not null]
product_order_idx int [not null]
indexes {
(order_id, product_order_idx) [unique]
}
}
Table operations {
id int [pk]
operation varchar [not null]
description text
}
Enum event_type {
OPERATION
INFO
ERROR
}
Enum target_type {
BODY
NECK
}
Table events {
id int [pk]
product_id int [ref: > products.id, not null]
operation_id int [ref: > operations.id]
ordinal int [not null, note: "liczba porzadkowa, wielokrotnosc 32, zeby mozna bylo dodac pomiedzy"]
type event_type [not null, default: "OPERATION"]
target target_type [not null, default: "BODY"]
date date [not null]
description text
photo image
}
Table production_lists {
id int [pk]
name varchar [not null, unique]
description text
}
Table production_list_products {
id int [pk]
product_id int [ref: > products.id, not null]
prod_list_id int [ref: > production_lists.id, not null]
indexes {
(product_id, prod_list_id) [unique]
}
}