aboutsummaryrefslogtreecommitdiff
path: root/res/sql/tables/orcl_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/orcl_add_constraints_defaults.sql
parent999d0ebce6b2f4ba39ee55daa52ca33f5fac657c (diff)
downloadminibay-afe377a9b10b5c1b2badc74d4b9b636e7c4d0cbf.tar.gz
Add E-R model and SQL bootstrap scripts
Diffstat (limited to 'res/sql/tables/orcl_add_constraints_defaults.sql')
-rw-r--r--res/sql/tables/orcl_add_constraints_defaults.sql36
1 files changed, 36 insertions, 0 deletions
diff --git a/res/sql/tables/orcl_add_constraints_defaults.sql b/res/sql/tables/orcl_add_constraints_defaults.sql
new file mode 100644
index 0000000..4fd386c
--- /dev/null
+++ b/res/sql/tables/orcl_add_constraints_defaults.sql
@@ -0,0 +1,36 @@
1-- constraints
2
3ALTER TABLE USERS
4ADD CONSTRAINT username_unique UNIQUE (USERNAME);
5
6
7-- defaults
8
9-- oracle can not use user defined functions (gen_uuid()) as default values :c
10
11ALTER TABLE USERS
12MODIFY UUID DEFAULT regexp_replace(rawtohex(sys_guid())
13, '([A-F0-9]{8})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{12})'
14, '\1-\2-\3-\4-\5');
15
16ALTER TABLE BIDS
17MODIFY UUID DEFAULT regexp_replace(rawtohex(sys_guid())
18, '([A-F0-9]{8})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{12})'
19, '\1-\2-\3-\4-\5');
20
21ALTER TABLE CHARGES
22MODIFY UUID DEFAULT regexp_replace(rawtohex(sys_guid())
23, '([A-F0-9]{8})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{12})'
24, '\1-\2-\3-\4-\5');
25
26ALTER TABLE ITEMS
27MODIFY UUID DEFAULT regexp_replace(rawtohex(sys_guid())
28, '([A-F0-9]{8})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{12})'
29, '\1-\2-\3-\4-\5');
30
31ALTER TABLE TRANSACTIONS
32MODIFY UUID DEFAULT regexp_replace(rawtohex(sys_guid())
33, '([A-F0-9]{8})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{4})([A-F0-9]{12})'
34, '\1-\2-\3-\4-\5');
35
36COMMIT;