database preload fixed to match new schema

pull/306/merge
Justin Richer 2013-03-04 16:10:32 -05:00
parent 1f5f7c8aac
commit ea034f7d4a
2 changed files with 13 additions and 13 deletions

View File

@ -21,11 +21,11 @@ INSERT INTO client_scope_TEMP (owner_id, scope) VALUES
('client', 'phone'), ('client', 'phone'),
('client', 'offline_access'); ('client', 'offline_access');
INSERT INTO redirect_uri_TEMP (owner_id, redirect_uri) VALUES INSERT INTO client_redirect_uri_TEMP (owner_id, redirect_uri) VALUES
('client', 'http://localhost/'), ('client', 'http://localhost/'),
('client', 'http://localhost:8080/'); ('client', 'http://localhost:8080/');
INSERT INTO authorized_grant_type_TEMP (owner_id, authorized_grant_type) VALUES INSERT INTO client_grant_type_TEMP (owner_id, grant_type) VALUES
('client', 'authorization_code'), ('client', 'authorization_code'),
('client', 'urn:ietf:params:oauth:grant_type:redelegate'), ('client', 'urn:ietf:params:oauth:grant_type:redelegate'),
('client', 'implicit'), ('client', 'implicit'),
@ -47,17 +47,17 @@ MERGE INTO client_scope
WHEN NOT MATCHED THEN WHEN NOT MATCHED THEN
INSERT (owner_id, scope) values (vals.id, vals.scope); INSERT (owner_id, scope) values (vals.id, vals.scope);
MERGE INTO redirect_uri MERGE INTO client_redirect_uri
USING (SELECT id, redirect_uri FROM redirect_uri_TEMP, client_details WHERE client_details.client_id = redirect_uri_TEMP.owner_id) AS vals(id, redirect_uri) USING (SELECT id, redirect_uri FROM client_redirect_uri_TEMP, client_details WHERE client_details.client_id = client_redirect_uri_TEMP.owner_id) AS vals(id, redirect_uri)
ON vals.id = redirect_uri.owner_id AND vals.redirect_uri = redirect_uri.redirect_uri ON vals.id = client_redirect_uri.owner_id AND vals.redirect_uri = client_redirect_uri.redirect_uri
WHEN NOT MATCHED THEN WHEN NOT MATCHED THEN
INSERT (owner_id, redirect_uri) values (vals.id, vals.redirect_uri); INSERT (owner_id, redirect_uri) values (vals.id, vals.redirect_uri);
MERGE INTO authorized_grant_type MERGE INTO client_grant_type
USING (SELECT id, authorized_grant_type FROM authorized_grant_type_TEMP, client_details WHERE client_details.client_id = authorized_grant_type_TEMP.owner_id) AS vals(id, authorized_grant_type) USING (SELECT id, grant_type FROM client_grant_type_TEMP, client_details WHERE client_details.client_id = client_grant_type_TEMP.owner_id) AS vals(id, grant_type)
ON vals.id = authorized_grant_type.owner_id AND vals.authorized_grant_type = authorized_grant_type.authorized_grant_type ON vals.id = client_grant_type.owner_id AND vals.grant_type = client_grant_type.grant_type
WHEN NOT MATCHED THEN WHEN NOT MATCHED THEN
INSERT (owner_id, authorized_grant_type) values (vals.id, vals.authorized_grant_type); INSERT (owner_id, grant_type) values (vals.id, vals.grant_type);
-- --
-- Close the transaction and turn autocommit back on -- Close the transaction and turn autocommit back on

View File

@ -1,6 +1,6 @@
-- --
-- Temporary tables used during the bootstrapping process to safely load users and clients. -- Temporary tables used during the bootstrapping process to safely load users and clients.
-- These are not needed if you're not using the users.sql file to bootstrap the database. -- These are not needed if you're not using the users.sql/clients.sql files to bootstrap the database.
-- --
CREATE TEMPORARY TABLE IF NOT EXISTS authorities_TEMP ( CREATE TEMPORARY TABLE IF NOT EXISTS authorities_TEMP (
@ -55,14 +55,14 @@ CREATE TEMPORARY TABLE IF NOT EXISTS client_scope_TEMP (
scope VARCHAR(2048) scope VARCHAR(2048)
); );
CREATE TEMPORARY TABLE IF NOT EXISTS redirect_uri_TEMP ( CREATE TEMPORARY TABLE IF NOT EXISTS client_redirect_uri_TEMP (
owner_id VARCHAR(256), owner_id VARCHAR(256),
redirect_uri VARCHAR(2048) redirect_uri VARCHAR(2048)
); );
CREATE TEMPORARY TABLE IF NOT EXISTS authorized_grant_type_TEMP ( CREATE TEMPORARY TABLE IF NOT EXISTS client_grant_type_TEMP (
owner_id VARCHAR(256), owner_id VARCHAR(256),
authorized_grant_type VARCHAR(2000) grant_type VARCHAR(2000)
); );
CREATE TEMPORARY TABLE IF NOT EXISTS system_scope_TEMP ( CREATE TEMPORARY TABLE IF NOT EXISTS system_scope_TEMP (