Skip to content

Commit

Permalink
fix: incidence database
Browse files Browse the repository at this point in the history
  • Loading branch information
24Victor committed Dec 3, 2024
1 parent 2e8e3d6 commit ca6f501
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion database/start-scripts/0-init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,16 @@ create table elements (
zone_id int not null,
point_id int unique,
tree_type_id int null,
incidence_id int NULL,
created_at timestamp default current_timestamp,
updated_at timestamp,
deleted_at timestamp,
foreign key (contract_id) references contracts(id),
foreign key (zone_id) references zones(id),
foreign key (point_id) references points(id),
foreign key (tree_type_id) references tree_types(id),
foreign key (element_type_id) references element_types(id)
foreign key (element_type_id) references element_types(id),
forgein key (incidence_id) references incidences(id)
);

create table incidences (
Expand Down
8 changes: 4 additions & 4 deletions database/start-scripts/1-seed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ INSERT INTO route_points (route_id, point_id, point_order) VALUES
(2, 3, 2);

--* Elements
INSERT INTO elements (element_type_id, contract_id, zone_id, point_id, tree_type_id) VALUES
(1, 1, 1, 1, 1),
(2, 2, 2, 2, NULL),
(3, 3, 3, 3, NULL);
INSERT INTO elements (element_type_id, contract_id, zone_id, point_id, tree_type_id, incidence_id) VALUES
(1, 1, 1, 1, 1, NULL),
(2, 2, 2, 2, NULL, NULL),
(3, 3, 3, 3, NULL), NULL;

--* Incidences
INSERT INTO incidences (element_id, name, description, photo_id) VALUES
Expand Down

0 comments on commit ca6f501

Please sign in to comment.