summaryrefslogtreecommitdiff
path: root/schema
diff options
context:
space:
mode:
Diffstat (limited to 'schema')
-rw-r--r--schema/init.sql14
1 files changed, 14 insertions, 0 deletions
diff --git a/schema/init.sql b/schema/init.sql
index 682431c..8950a5f 100644
--- a/schema/init.sql
+++ b/schema/init.sql
@@ -18,3 +18,17 @@ CREATE TABLE positions(
CONSTRAINT fk_users_id
FOREIGN KEY(user_id) REFERENCES users(id)
);
+
+CREATE TYPE level_alert AS ENUM ('One', 'Two', 'Three');
+
+CREATE TABLE alerts(
+ id SERIAL NOT NULL,
+ user_id INTEGER NOT NULL,
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
+ area GEOMETRY(Polygon, 4326),
+ level level_alert NOT NULL,
+ reached_users INTEGER DEFAULT 0 NOT NULL,
+ PRIMARY KEY(id),
+ CONSTRAINT fk_users_id
+ FOREIGN KEY(user_id) REFERENCES users(id)
+);