diff --git a/db_schema b/db_schema index 9e6ca04..3134bcf 100644 --- a/db_schema +++ b/db_schema @@ -30,7 +30,7 @@ Enum part_type { Table parts { id int [pk] product_id int [ref: > products.id, not null] - type part_type_type [not null] + type part_type [not null] color_top int [ref: > colors.id, not null] color_back int [ref: > colors.id, not null] finish_top finish_type [not null] @@ -112,6 +112,11 @@ Table events { indexes { (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 {