From 9f02efe7f1073c1f8e5a5f3efd84dd88c622de09 Mon Sep 17 00:00:00 2001 From: Tommy Wang Date: Tue, 12 Oct 2010 15:02:20 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0user=5Fsetting=5Fmap=E8=A1=A8?= =?utf8?q?=E7=9A=84=E5=A4=96=E9=94=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- jibu-core/src/main/resources/dbscripts/derby/createdb.sql | 14 ++++++++------ jibu-core/src/main/resources/dbscripts/mysql/createdb.sql | 14 ++++++++------ jibu-core/src/main/resources/dbscripts/oracle/createdb.sql | 13 +++++++------ .../src/main/resources/dbscripts/postgresql/createdb.sql | 14 ++++++++------ 4 files changed, 31 insertions(+), 24 deletions(-) diff --git a/jibu-core/src/main/resources/dbscripts/derby/createdb.sql b/jibu-core/src/main/resources/dbscripts/derby/createdb.sql index 76151d2..90e34d2 100644 --- a/jibu-core/src/main/resources/dbscripts/derby/createdb.sql +++ b/jibu-core/src/main/resources/dbscripts/derby/createdb.sql @@ -31,7 +31,7 @@ CREATE TABLE user_role_map ( user_id integer NOT NULL, role_id integer NOT NULL ); -ALTER TABLE user_role_map ADD CONSTRAINT user_role_map_ur_id_uq UNIQUE ( user_id,role_id ); +ALTER TABLE user_role_map ADD CONSTRAINT urmap_user_id_role_id_uq UNIQUE ( user_id,role_id ); ALTER TABLE user_role_map ADD CONSTRAINT urmap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); ALTER TABLE user_role_map ADD CONSTRAINT urmap_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); @@ -48,9 +48,9 @@ CREATE TABLE role_authority_map ( role_id integer NOT NULL, authority_id integer NOT NULL ); -ALTER TABLE role_authority_map ADD CONSTRAINT role_authority_map_ra_id_uq UNIQUE ( role_id,authority_id ); -ALTER TABLE role_authority_map ADD CONSTRAINT rrmap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); -ALTER TABLE role_authority_map ADD CONSTRAINT rrmap_authority_id_fk FOREIGN KEY (authority_id) REFERENCES authorities (id); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_role_id_authority_id_uq UNIQUE ( role_id,authority_id ); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_authority_id_fk FOREIGN KEY (authority_id) REFERENCES authorities (id); -- ------------------------------------------------------ CREATE TABLE settings( @@ -68,7 +68,9 @@ CREATE TABLE user_setting_map( user_id integer NOT NULL, setting_id integer NOT NULL ); -ALTER TABLE user_setting_map ADD CONSTRAINT usm_user_id_setting_id_uq UNIQUE ( user_id,setting_id ); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_user_id_setting_id_uq UNIQUE ( user_id,setting_id ); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_setting_id_fk FOREIGN KEY (setting_id) REFERENCES settings (id); -- ------------------------------------------------------ CREATE TABLE tokens ( @@ -79,4 +81,4 @@ CREATE TABLE tokens ( user_id integer NOT NULL ); ALTER TABLE tokens ADD CONSTRAINT tokens_value_uq UNIQUE ( value ); -ALTER TABLE tokens ADD CONSTRAINT tokens_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); \ No newline at end of file +ALTER TABLE tokens ADD CONSTRAINT tokens_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); diff --git a/jibu-core/src/main/resources/dbscripts/mysql/createdb.sql b/jibu-core/src/main/resources/dbscripts/mysql/createdb.sql index f45e9ac..2858e67 100644 --- a/jibu-core/src/main/resources/dbscripts/mysql/createdb.sql +++ b/jibu-core/src/main/resources/dbscripts/mysql/createdb.sql @@ -31,7 +31,7 @@ CREATE TABLE user_role_map ( user_id integer NOT NULL, role_id integer NOT NULL ); -ALTER TABLE user_role_map ADD CONSTRAINT user_role_map_ur_id_uq UNIQUE ( user_id,role_id ); +ALTER TABLE user_role_map ADD CONSTRAINT urmap_user_id_role_id_uq UNIQUE ( user_id,role_id ); ALTER TABLE user_role_map ADD CONSTRAINT urmap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); ALTER TABLE user_role_map ADD CONSTRAINT urmap_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); @@ -48,9 +48,9 @@ CREATE TABLE role_authority_map ( role_id integer NOT NULL, authority_id integer NOT NULL ); -ALTER TABLE role_authority_map ADD CONSTRAINT role_authority_map_ra_id_uq UNIQUE ( role_id,authority_id ); -ALTER TABLE role_authority_map ADD CONSTRAINT rrmap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); -ALTER TABLE role_authority_map ADD CONSTRAINT rrmap_authority_id_fk FOREIGN KEY (authority_id) REFERENCES authorities (id); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_role_id_authority_id_uq UNIQUE ( role_id,authority_id ); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_authority_id_fk FOREIGN KEY (authority_id) REFERENCES authorities (id); -- ------------------------------------------------------ CREATE TABLE settings( @@ -68,7 +68,9 @@ CREATE TABLE user_setting_map( user_id integer NOT NULL, setting_id integer NOT NULL ); -ALTER TABLE user_setting_map ADD CONSTRAINT usm_user_id_setting_id_uq UNIQUE ( user_id,setting_id ); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_user_id_setting_id_uq UNIQUE ( user_id,setting_id ); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_setting_id_fk FOREIGN KEY (setting_id) REFERENCES settings (id); -- ------------------------------------------------------ CREATE TABLE tokens ( @@ -79,4 +81,4 @@ CREATE TABLE tokens ( user_id integer NOT NULL ); ALTER TABLE tokens ADD CONSTRAINT tokens_value_uq UNIQUE ( value ); -ALTER TABLE tokens ADD CONSTRAINT tokens_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); \ No newline at end of file +ALTER TABLE tokens ADD CONSTRAINT tokens_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); diff --git a/jibu-core/src/main/resources/dbscripts/oracle/createdb.sql b/jibu-core/src/main/resources/dbscripts/oracle/createdb.sql index 6649137..7a7a88e 100644 --- a/jibu-core/src/main/resources/dbscripts/oracle/createdb.sql +++ b/jibu-core/src/main/resources/dbscripts/oracle/createdb.sql @@ -41,7 +41,7 @@ CREATE TABLE user_role_map ( user_id integer NOT NULL, role_id integer NOT NULL ); -ALTER TABLE user_role_map ADD CONSTRAINT user_role_map_ur_id_uq UNIQUE ( user_id,role_id ); +ALTER TABLE user_role_map ADD CONSTRAINT urmap_user_id_role_id_uq UNIQUE ( user_id,role_id ); ALTER TABLE user_role_map ADD CONSTRAINT urmap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); ALTER TABLE user_role_map ADD CONSTRAINT urmap_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); @@ -63,9 +63,9 @@ CREATE TABLE role_authority_map ( role_id integer NOT NULL, authority_id integer NOT NULL ); -ALTER TABLE role_authority_map ADD CONSTRAINT role_authority_map_ra_id_uq UNIQUE ( role_id,authority_id ); -ALTER TABLE role_authority_map ADD CONSTRAINT rrmap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); -ALTER TABLE role_authority_map ADD CONSTRAINT rrmap_authority_id_fk FOREIGN KEY (authority_id) REFERENCES authorities (id); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_role_id_authority_id_uq UNIQUE ( role_id,authority_id ); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_authority_id_fk FOREIGN KEY (authority_id) REFERENCES authorities (id); -- ------------------------------------------------------ CREATE TABLE settings( @@ -88,7 +88,9 @@ CREATE TABLE user_setting_map( user_id integer NOT NULL, setting_id integer NOT NULL ); -ALTER TABLE user_setting_map ADD CONSTRAINT usm_user_id_setting_id_uq UNIQUE ( user_id,setting_id ); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_user_id_setting_id_uq UNIQUE ( user_id,setting_id ); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_setting_id_fk FOREIGN KEY (setting_id) REFERENCES settings (id); -- ------------------------------------------------------ CREATE TABLE tokens ( @@ -105,4 +107,3 @@ CREATE sequence tokens_seq; CREATE OR REPLACE trigger trg_tokens before insert on tokens for each row BEGIN select tokens_seq.nextval into :new.id from dual; END; / - diff --git a/jibu-core/src/main/resources/dbscripts/postgresql/createdb.sql b/jibu-core/src/main/resources/dbscripts/postgresql/createdb.sql index 9b1f669..6916947 100644 --- a/jibu-core/src/main/resources/dbscripts/postgresql/createdb.sql +++ b/jibu-core/src/main/resources/dbscripts/postgresql/createdb.sql @@ -31,7 +31,7 @@ CREATE TABLE user_role_map ( user_id integer NOT NULL, role_id integer NOT NULL ); -ALTER TABLE user_role_map ADD CONSTRAINT user_role_map_ur_id_uq UNIQUE ( user_id,role_id ); +ALTER TABLE user_role_map ADD CONSTRAINT urmap_user_id_role_id_uq UNIQUE ( user_id,role_id ); ALTER TABLE user_role_map ADD CONSTRAINT urmap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); ALTER TABLE user_role_map ADD CONSTRAINT urmap_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); @@ -48,9 +48,9 @@ CREATE TABLE role_authority_map ( role_id integer NOT NULL, authority_id integer NOT NULL ); -ALTER TABLE role_authority_map ADD CONSTRAINT role_authority_map_ra_id_uq UNIQUE ( role_id,authority_id ); -ALTER TABLE role_authority_map ADD CONSTRAINT rrmap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); -ALTER TABLE role_authority_map ADD CONSTRAINT rrmap_authority_id_fk FOREIGN KEY (authority_id) REFERENCES authorities (id); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_role_id_authority_id_uq UNIQUE ( role_id,authority_id ); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_role_id_fk FOREIGN KEY (role_id) REFERENCES roles (id); +ALTER TABLE role_authority_map ADD CONSTRAINT ramap_authority_id_fk FOREIGN KEY (authority_id) REFERENCES authorities (id); -- ------------------------------------------------------ CREATE TABLE settings( @@ -68,7 +68,9 @@ CREATE TABLE user_setting_map( user_id integer NOT NULL, setting_id integer NOT NULL ); -ALTER TABLE user_setting_map ADD CONSTRAINT usm_user_id_setting_id_uq UNIQUE ( user_id,setting_id ); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_user_id_setting_id_uq UNIQUE ( user_id,setting_id ); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); +ALTER TABLE user_setting_map ADD CONSTRAINT usmap_setting_id_fk FOREIGN KEY (setting_id) REFERENCES settings (id); -- ------------------------------------------------------ CREATE TABLE tokens ( @@ -79,4 +81,4 @@ CREATE TABLE tokens ( user_id integer NOT NULL ); ALTER TABLE tokens ADD CONSTRAINT tokens_value_uq UNIQUE ( value ); -ALTER TABLE tokens ADD CONSTRAINT tokens_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); \ No newline at end of file +ALTER TABLE tokens ADD CONSTRAINT tokens_user_id_fk FOREIGN KEY (user_id) REFERENCES userbase (id); -- 2.11.4.GIT