diff --git a/data.sql b/data.sql index 349d61b..00f1bbe 100644 --- a/data.sql +++ b/data.sql @@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS users ( name varchar(50) , surname varchar(50), email varchar(50) UNIQUE NOT NULL, - password varchar(50) NOT NULL, + password varchar(150) NOT NULL, createdAt timestamp NOT NULL DEFAULT NOW(), updatedAt timestamp ); @@ -98,6 +98,23 @@ CREATE TABLE IF NOT EXISTS policy_fields( updatedAt timestamp ); +CREATE TABLE IF NOT EXISTS policy_sources( + id serial PRIMARY KEY, + policy_id integer, + source_id integer, + + CONSTRAINT policy_field_policy_id_fkey FOREIGN KEY (policy_id) + REFERENCES policies(id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE CASCADE, + + CONSTRAINT policy_source_source_id_fkkey FOREIGN KEY (source_id) + REFERENCES sources(id) MATCH SIMPLE + ON UPDATE NO ACTION ON DELETE CASCADE, + + createdAt timestamp NOT NULL DEFAULT NOW(), + updatedAt timestamp +); + CREATE TABLE IF NOT EXISTS groups ( id serial PRIMARY KEY,