From 8b3701124473b4cfce353e25ceb5a21afe77bd0e Mon Sep 17 00:00:00 2001 From: Justin Richer Date: Tue, 4 Dec 2012 13:35:40 -0500 Subject: [PATCH] added casts to varchar to avoid extraneous spaces --- .../src/main/resources/db/tables/security-schema.sql | 8 ++++---- openid-connect-server/src/main/resources/db/users.sql | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/openid-connect-server/src/main/resources/db/tables/security-schema.sql b/openid-connect-server/src/main/resources/db/tables/security-schema.sql index 4b0dbd68d..b9b2b3b22 100644 --- a/openid-connect-server/src/main/resources/db/tables/security-schema.sql +++ b/openid-connect-server/src/main/resources/db/tables/security-schema.sql @@ -1,10 +1,10 @@ create table IF NOT EXISTS users( - username varchar_ignorecase(50) not null primary key, - password varchar_ignorecase(50) not null, + username varchar(50) not null primary key, + password varchar(50) not null, enabled boolean not null); create table IF NOT EXISTS authorities ( - username varchar_ignorecase(50) not null, - authority varchar_ignorecase(50) not null, + username varchar(50) not null, + authority varchar(50) not null, constraint fk_authorities_users foreign key(username) references users(username), constraint ix_authority unique (username,authority)); \ No newline at end of file diff --git a/openid-connect-server/src/main/resources/db/users.sql b/openid-connect-server/src/main/resources/db/users.sql index 41d853f89..da3bad8c5 100644 --- a/openid-connect-server/src/main/resources/db/users.sql +++ b/openid-connect-server/src/main/resources/db/users.sql @@ -3,13 +3,16 @@ MERGE INTO users ON vals.username = users.username WHEN NOT MATCHED THEN INSERT (username, password, enabled) VALUES(vals.username, vals.password, vals.enabled); - + MERGE INTO authorities - USING (VALUES('jricher', 'ROLE_USER'), ('jricher', 'ROLE_ADMIN'), ('jricher', 'ROLE_AWESOME')) AS vals(username, authority) + USING (VALUES ('jricher', CAST('ROLE_USER' AS varchar(50))), ('jricher', CAST('ROLE_ADMIN' AS varchar(50))), ('jricher', CAST('ROLE_AWESOME' AS varchar(50)))) AS vals(username, authority) +-- USING (VALUES ('jricher', 'ROLE_USER'), ('jricher', 'ROLE_ADMIN'), ('jricher', 'ROLE_AWESOME')) AS vals(username varchar(50), authority varchar(50)) ON vals.username = authorities.username AND vals.authority = authorities.authority WHEN NOT MATCHED THEN INSERT (username,authority) values (vals.username, vals.authority); - + +--INSERT INTO authorities (username, authority) VALUES ('jricher', 'ROLE_USER'), ('jricher', 'ROLE_ADMIN'); + MERGE INTO user_info USING (VALUES('user1-abc123', 'jricher', 'Justin Richer', false)) AS vals(user_id, preferred_username, name, email_verified) ON vals.preferred_username = user_info.preferred_username