ok for form to add entry for equipment not listed, next save entry and equipment in db

This commit is contained in:
JBthePenguin 2021-06-05 00:30:48 +02:00
parent 5b47a9d0ba
commit cd22b2a759
17 changed files with 178 additions and 25 deletions

View file

@ -13,10 +13,9 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_location (
CREATE TABLE IF NOT EXISTS plugin_materiels_equipment (
id integer NOT NULL PRIMARY KEY autoincrement,
category_id integer NOT NULL,
designation varchar(255) NOT NULL,
localisation_id integer NOT NULL,
current_value decimal NOT NULL DEFAULT 0,
number_of_materiels integer NOT NULL DEFAULT 1,
number_of_equipments integer NOT NULL,
designation varchar(255) NOT NULL,
CONSTRAINT u_equipment_designation UNIQUE ( designation ),
FOREIGN KEY ( category_id ) REFERENCES plugin_materiels_category( id ) ON DELETE RESTRICT ON UPDATE CASCADE,
FOREIGN KEY ( localisation_id ) REFERENCES plugin_materiels_location( id ) ON DELETE RESTRICT ON UPDATE CASCADE
@ -25,6 +24,7 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_equipment (
CREATE TABLE IF NOT EXISTS plugin_materiels_entry (
id integer NOT NULL PRIMARY KEY autoincrement,
kind varchar(20) NOT NULL,
number_of_equipments integer NOT NULL,
equipment_id integer NOT NULL,
date_of_entry date NOT NULL,
FOREIGN KEY ( equipment_id ) REFERENCES plugin_materiels_equipment( id ) ON DELETE RESTRICT ON UPDATE CASCADE
@ -33,6 +33,7 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_entry (
CREATE TABLE IF NOT EXISTS plugin_materiels_temporary_entry (
id integer NOT NULL PRIMARY KEY autoincrement,
kind varchar(20) NOT NULL,
number_of_equipments integer NOT NULL,
equipment_id integer NOT NULL,
start_date date NOT NULL,
end_date date,
@ -42,6 +43,7 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_temporary_entry (
CREATE TABLE IF NOT EXISTS plugin_materiels_output (
id integer NOT NULL PRIMARY KEY autoincrement,
kind varchar(20) NOT NULL,
number_of_equipments integer NOT NULL,
equipment_id integer NOT NULL,
output_date date NOT NULL,
FOREIGN KEY ( equipment_id ) REFERENCES plugin_materiels_entry( equipment_id ) ON DELETE RESTRICT ON UPDATE CASCADE
@ -50,6 +52,7 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_output (
CREATE TABLE IF NOT EXISTS plugin_materiels_temporary_output (
id integer NOT NULL PRIMARY KEY autoincrement,
kind varchar(20) NOT NULL,
number_of_equipments integer NOT NULL,
equipment_id integer NOT NULL,
start_date date NOT NULL,
end_date date,