diff options
author | Pacien TRAN-GIRARD | 2015-01-27 18:01:45 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2015-01-27 18:27:51 +0100 |
commit | afe377a9b10b5c1b2badc74d4b9b636e7c4d0cbf (patch) | |
tree | e6808c16b8bf7b7a2cd79435706465181cbe4295 /res/sql/tables/pg_add_constraints_defaults.sql | |
parent | 999d0ebce6b2f4ba39ee55daa52ca33f5fac657c (diff) | |
download | minibay-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.sql | 26 |
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 | |||
3 | ALTER TABLE USERS | ||
4 | ADD CONSTRAINT username_unique UNIQUE (USERNAME); | ||
5 | |||
6 | |||
7 | -- defaults | ||
8 | |||
9 | CREATE EXTENSION "uuid-ossp"; | ||
10 | |||
11 | ALTER TABLE USERS | ||
12 | ALTER COLUMN UUID SET DEFAULT gen_uuid(); | ||
13 | |||
14 | ALTER TABLE BIDS | ||
15 | ALTER COLUMN UUID SET DEFAULT gen_uuid(); | ||
16 | |||
17 | ALTER TABLE CHARGES | ||
18 | ALTER COLUMN UUID SET DEFAULT gen_uuid(); | ||
19 | |||
20 | ALTER TABLE ITEMS | ||
21 | ALTER COLUMN UUID SET DEFAULT gen_uuid(); | ||
22 | |||
23 | ALTER TABLE TRANSACTIONS | ||
24 | ALTER COLUMN UUID SET DEFAULT gen_uuid(); | ||
25 | |||
26 | COMMIT; | ||