added casts to varchar to avoid extraneous spaces
parent
e305d3b16b
commit
8b37011244
|
@ -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));
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue