diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/downgrade_0044---0043.sql | 7 | ||||
-rw-r--r-- | db/schema.sql | 7 | ||||
-rw-r--r-- | db/schema_0044-contact_response_templates.sql | 12 |
3 files changed, 26 insertions, 0 deletions
diff --git a/db/downgrade_0044---0043.sql b/db/downgrade_0044---0043.sql new file mode 100644 index 000000000..d3a7642ad --- /dev/null +++ b/db/downgrade_0044---0043.sql @@ -0,0 +1,7 @@ +BEGIN; + +ALTER TABLE response_templates DROP COLUMN auto_response; + +DROP TABLE contact_response_templates; + +COMMIT; diff --git a/db/schema.sql b/db/schema.sql index b11bb30b7..c96059fb1 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -473,5 +473,12 @@ create table response_templates ( title text not null, text text not null, created timestamp not null default current_timestamp, + auto_response boolean NOT NULL DEFAULT 'f', unique(body_id, title) ); + +CREATE TABLE contact_response_templates ( + id serial NOT NULL PRIMARY KEY, + contact_id int REFERENCES contacts(id) NOT NULL, + response_template_id int REFERENCES response_templates(id) NOT NULL +); diff --git a/db/schema_0044-contact_response_templates.sql b/db/schema_0044-contact_response_templates.sql new file mode 100644 index 000000000..e85d99fb8 --- /dev/null +++ b/db/schema_0044-contact_response_templates.sql @@ -0,0 +1,12 @@ +BEGIN; + +CREATE TABLE contact_response_templates ( + id serial NOT NULL PRIMARY KEY, + contact_id int REFERENCES contacts(id) NOT NULL, + response_template_id int REFERENCES response_templates(id) NOT NULL +); + +ALTER TABLE response_templates + ADD COLUMN auto_response boolean NOT NULL DEFAULT 'f'; + +COMMIT; |