wersja 4 db schema
uproszczenie tabeli events
This commit is contained in:
37
db_schema
37
db_schema
@@ -88,35 +88,46 @@ Table operations {
|
|||||||
description text
|
description text
|
||||||
}
|
}
|
||||||
|
|
||||||
Enum event_type {
|
Enum event_kind {
|
||||||
OPERATION
|
OPERATION
|
||||||
|
NOTE
|
||||||
|
}
|
||||||
|
|
||||||
|
Enum note_type {
|
||||||
INFO
|
INFO
|
||||||
ERROR
|
ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
Table event_info {
|
Table event_operations {
|
||||||
|
id int [pk]
|
||||||
|
event_id int [ref: - events.id, not null, unique]
|
||||||
|
operation_id int [ref: > operations.id, not null]
|
||||||
|
}
|
||||||
|
|
||||||
|
Table event_notes {
|
||||||
|
id int [pk]
|
||||||
|
event_id int [ref: - events.id, not null, unique]
|
||||||
|
type note_type [not null]
|
||||||
|
note text [not null]
|
||||||
|
}
|
||||||
|
|
||||||
|
Table event_photos {
|
||||||
id int [pk]
|
id int [pk]
|
||||||
event_id int [ref: > events.id, not null]
|
event_id int [ref: > events.id, not null]
|
||||||
comment text [default: null]
|
photo_url varchar [not null]
|
||||||
photo_url varchar [default: null]
|
description text
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Table events {
|
Table events {
|
||||||
id int [pk]
|
id int [pk]
|
||||||
part_id int [ref: > parts.id, not null]
|
part_id int [ref: > parts.id, not null]
|
||||||
operation_id int [ref: > operations.id]
|
|
||||||
ordinal int [not null, note: "liczba porzadkowa, wielokrotnosc 32, zeby mozna bylo dodac pomiedzy"]
|
ordinal int [not null, note: "liczba porzadkowa, wielokrotnosc 32, zeby mozna bylo dodac pomiedzy"]
|
||||||
type event_type [not null, default: "OPERATION"]
|
kind event_kind [not null, default: "OPERATION"]
|
||||||
date date [not null, note: "data jest ustawiana po wykonaniu operacji, niekonicznie w ten sam dzien. mozna edytowac"]
|
date date [not null, note: "data jest ustawiana po wykonaniu operacji, niekonicznie w ten sam dzien. mozna edytowac"]
|
||||||
|
|
||||||
indexes {
|
indexes {
|
||||||
(part_id, ordinal) [unique]
|
(part_id, ordinal) [unique]
|
||||||
}
|
}
|
||||||
|
|
||||||
checks {
|
|
||||||
`type != 'OPERATION' OR operation_id IS NOT NULL` [name: 'chk_event_operation_required']
|
|
||||||
`type = 'OPERATION' OR operation_id IS NULL` [name: 'chk_event_operation_forbidden']
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Table production_lists {
|
Table production_lists {
|
||||||
@@ -133,4 +144,4 @@ Table production_list_products {
|
|||||||
indexes {
|
indexes {
|
||||||
(product_id, prod_list_id) [unique]
|
(product_id, prod_list_id) [unique]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user