aboutsummaryrefslogtreecommitdiff
path: root/res/sql/tables/pg_add_constraints_defaults.sql
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-01-27 18:01:45 +0100
committerPacien TRAN-GIRARD2015-01-27 18:27:51 +0100
commitafe377a9b10b5c1b2badc74d4b9b636e7c4d0cbf (patch)
treee6808c16b8bf7b7a2cd79435706465181cbe4295 /res/sql/tables/pg_add_constraints_defaults.sql
parent999d0ebce6b2f4ba39ee55daa52ca33f5fac657c (diff)
downloadminibay-afe377a9b10b5c1b2badc74d4b9b636e7c4d0cbf.tar.gz
Add E-R model and SQL bootstrap scripts
Diffstat (limited to 'res/sql/tables/pg_add_constraints_defaults.sql')
-rw-r--r--res/sql/tables/pg_add_constraints_defaults.sql26
1 files changed, 26 insertions, 0 deletions
diff --git a/res/sql/tables/pg_add_constraints_defaults.sql b/res/sql/tables/pg_add_constraints_defaults.sql
new file mode 100644
index 0000000..df9250d
--- /dev/null
+++ b/res/sql/tables/pg_add_constraints_defaults.sql
@@ -0,0 +1,26 @@
1-- constraints
2
3ALTER TABLE USERS
4ADD CONSTRAINT username_unique UNIQUE (USERNAME);
5
6
7-- defaults
8
9CREATE EXTENSION "uuid-ossp";
10
11ALTER TABLE USERS
12ALTER COLUMN UUID SET DEFAULT gen_uuid();
13
14ALTER TABLE BIDS
15ALTER COLUMN UUID SET DEFAULT gen_uuid();
16
17ALTER TABLE CHARGES
18ALTER COLUMN UUID SET DEFAULT gen_uuid();
19
20ALTER TABLE ITEMS
21ALTER COLUMN UUID SET DEFAULT gen_uuid();
22
23ALTER TABLE TRANSACTIONS
24ALTER COLUMN UUID SET DEFAULT gen_uuid();
25
26COMMIT;