Skip to content

Commit

Permalink
[SQL] add: Data model for accident
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Nov 9, 2021
1 parent e0e5ad8 commit e18a2f7
Show file tree
Hide file tree
Showing 16 changed files with 345 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sql/accident/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
//Silence is golden
23 changes: 23 additions & 0 deletions sql/accident/llx_c_accident_location.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_c_accident_location(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer default 1,
ref varchar(128),
label varchar(255),
description text,
active tinyint(4) DEFAULT 0
) ENGINE=innodb;
23 changes: 23 additions & 0 deletions sql/accident/llx_c_lesion_localization.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_c_lesion_localization(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer default 1,
ref varchar(128),
label varchar(255),
description text,
active tinyint(4) DEFAULT 0
) ENGINE=innodb;
23 changes: 23 additions & 0 deletions sql/accident/llx_c_lesion_nature.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_c_lesion_nature(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer default 1,
ref varchar(128),
label varchar(255),
description text,
active tinyint(4) DEFAULT 0
) ENGINE=innodb;
18 changes: 18 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accident.key.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

ALTER TABLE llx_digiriskdolibarr_accident ADD INDEX idx_digiriskdolibarr_accident_rowid (rowid);
ALTER TABLE llx_digiriskdolibarr_accident ADD INDEX idx_digiriskdolibarr_accident_ref_ext (ref_ext);
ALTER TABLE llx_digiriskdolibarr_accident ADD CONSTRAINT llx_digiriskdolibarr_accident_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
32 changes: 32 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accident.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_digiriskdolibarr_accident(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
ref_ext varchar(128),
entity integer DEFAULT 1 NOT NULL,
date_creation datetime NOT NULL,
tms timestamp,
status smallint,
label varchar(255) NOT NULL,
accident_date datetime NOT NULL,
description text,
photo text,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
fk_element integer,
fk_user_victim integer
) ENGINE=innodb;
16 changes: 16 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accident_extrafields.key.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

ALTER TABLE llx_digiriskdolibarr_accident_extrafields ADD INDEX idx_fk_object(fk_object);
22 changes: 22 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accident_extrafields.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

create table llx_digiriskdolibarr_accident_extrafields(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
import_key varchar(14),
fk_object integer NOT NULL
) ENGINE=innodb;

17 changes: 17 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accident_signature.key.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

ALTER TABLE llx_digiriskdolibarr_accident_signature ADD INDEX idx_digiriskdolibarr_accident_signature_rowid (rowid);
ALTER TABLE llx_digiriskdolibarr_accident_signature ADD CONSTRAINT llx_digiriskdolibarr_accident_signature_fk_object FOREIGN KEY (fk_object) REFERENCES llx_digiriskdolibarr_accident(rowid);
40 changes: 40 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accident_signature.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_digiriskdolibarr_accident_signature(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer DEFAULT 1 NOT NULL,
date_creation datetime NOT NULL,
tms timestamp,
import_key integer DEFAULT NULL,
status smallint,
role varchar(255),
firstname varchar(255),
lastname varchar(255),
email varchar(255),
phone varchar(255),
address text,
society_name varchar(255),
signature_date datetime DEFAULT NULL,
signature_comment text DEFAULT NULL,
element_id integer NOT NULL,
element_type varchar(255),
signature text,
stamp text,
last_email_sent_date datetime DEFAULT NULL,
signature_url varchar(255),
transaction_url varchar(255),
fk_object integer NOT NULL
) ENGINE=innodb;
18 changes: 18 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accidentdet.key.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

ALTER TABLE llx_digiriskdolibarr_accidentdet ADD INDEX idx_digiriskdolibarr_accidentdet_rowid (rowid);
ALTER TABLE llx_digiriskdolibarr_accidentdet ADD INDEX idx_digiriskdolibarr_accidentdet_ref_ext (ref_ext);
ALTER TABLE llx_digiriskdolibarr_accidentdet ADD CONSTRAINT llx_digiriskdolibarr_accidentdet_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
25 changes: 25 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accidentdet.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_digiriskdolibarr_accidentdet(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
ref varchar(128) NOT NULL,
ref_ext varchar(128),
entity integer DEFAULT 1 NOT NULL,
date_creation datetime NOT NULL,
tms timestamp,
workstop_days integer,
fk_accident integer NOT NULL
) ENGINE=innodb;
16 changes: 16 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accidentdet_extrafields.key.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

ALTER TABLE llx_digiriskdolibarr_accidentdet_extrafields ADD INDEX idx_fk_object(fk_object);
22 changes: 22 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accidentdet_extrafields.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

create table llx_digiriskdolibarr_accidentdet_extrafields(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,
import_key varchar(14),
fk_object integer NOT NULL
) ENGINE=innodb;

16 changes: 16 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accidentmetadata.key.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

ALTER TABLE llx_digiriskdolibarr_accidentmetadata ADD INDEX idx_digiriskdolibarr_accidentmetadata_rowid (rowid);
32 changes: 32 additions & 0 deletions sql/accident/llx_digiriskdolibarr_accidentmetadata.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- Copyright (C) 2021 EOXIA <dev@eoxia.com>
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_digiriskdolibarr_accident(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer DEFAULT 1 NOT NULL,
date_creation datetime NOT NULL,
tms timestamp,
relative_location varchar(255),
lesion_localization text,
lesion_nature text,
thirdparty_responsibility boolean,
fatal boolean,
accident_investigation boolean,
accident_investigation_link boolean,
accident_location text,
collateral_victim boolean,
police_report boolean,
fk_accident integer NOT NULL
) ENGINE=innodb;

0 comments on commit e18a2f7

Please sign in to comment.