feat: update area management to implement hard delete and adjust related references
This commit is contained in:
@@ -82,7 +82,6 @@ CREATE TABLE IF NOT EXISTS areas (
|
||||
name VARCHAR(120) NOT NULL,
|
||||
description TEXT NULL,
|
||||
boundary_geojson JSON NOT NULL,
|
||||
active BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
UNIQUE KEY areas_name_unique (name)
|
||||
);
|
||||
|
||||
@@ -102,7 +101,7 @@ CREATE TABLE IF NOT EXISTS teams (
|
||||
active BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
UNIQUE KEY teams_name_unique (name),
|
||||
CONSTRAINT teams_category_fk FOREIGN KEY (team_category_id) REFERENCES team_categories(id),
|
||||
CONSTRAINT teams_area_fk FOREIGN KEY (area_id) REFERENCES areas(id)
|
||||
CONSTRAINT teams_area_fk FOREIGN KEY (area_id) REFERENCES areas(id) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS reports (
|
||||
@@ -119,7 +118,7 @@ CREATE TABLE IF NOT EXISTS reports (
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
CONSTRAINT reports_user_fk FOREIGN KEY (user_id) REFERENCES users(id),
|
||||
CONSTRAINT reports_category_fk FOREIGN KEY (category_id) REFERENCES report_categories(id),
|
||||
CONSTRAINT reports_area_fk FOREIGN KEY (area_id) REFERENCES areas(id),
|
||||
CONSTRAINT reports_area_fk FOREIGN KEY (area_id) REFERENCES areas(id) ON DELETE SET NULL,
|
||||
KEY reports_status_idx (status),
|
||||
KEY reports_category_idx (category_id),
|
||||
KEY reports_area_idx (area_id)
|
||||
|
||||
Reference in New Issue
Block a user