allow loading of structured scopes from scopes.sql file (and temp tables)
							parent
							
								
									5e676e0e59
								
							
						
					
					
						commit
						9720b60f05
					
				|  | @ -10,24 +10,23 @@ START TRANSACTION; | |||
| -- Insert scope information into the temporary tables. | ||||
| --  | ||||
| 
 | ||||
| INSERT INTO system_scope_TEMP (scope, description, icon, allow_dyn_reg, default_scope) VALUES | ||||
|   ('openid', 'log in using your identity', 'user', true, true), | ||||
|   ('profile', 'basic profile information', 'list-alt', true, true), | ||||
|   ('email', 'email address', 'envelope', true, true), | ||||
|   ('address', 'physical address', 'home', true, true), | ||||
|   ('phone', 'telephone number', 'bell', true, true), | ||||
|   ('offline_access', 'offline access', 'time', true, true); | ||||
| INSERT INTO system_scope_TEMP (scope, description, icon, allow_dyn_reg, default_scope, structured, structured_param_description) VALUES | ||||
|   ('openid', 'log in using your identity', 'user', true, true, false, null), | ||||
|   ('profile', 'basic profile information', 'list-alt', true, true, false, null), | ||||
|   ('email', 'email address', 'envelope', true, true, false, null), | ||||
|   ('address', 'physical address', 'home', true, true, false, null), | ||||
|   ('phone', 'telephone number', 'bell', true, true, false, null), | ||||
|   ('offline_access', 'offline access', 'time', true, true, false, null); | ||||
|    | ||||
| 
 | ||||
| -- | ||||
| -- Merge the temporary scopes safely into the database. This is a two-step process to keep scopes from being created on every startup with a persistent store. | ||||
| -- | ||||
| 
 | ||||
| MERGE INTO system_scope | ||||
| 	USING (SELECT scope, description, icon, allow_dyn_reg, default_scope FROM system_scope_TEMP) AS vals(scope, description, icon, allow_dyn_reg, default_scope) | ||||
| 	USING (SELECT scope, description, icon, allow_dyn_reg, default_scope, structured, structured_param_description FROM system_scope_TEMP) AS vals(scope, description, icon, allow_dyn_reg, default_scope, structured, structured_param_description) | ||||
| 	ON vals.scope = system_scope.scope | ||||
| 	WHEN NOT MATCHED THEN | ||||
| 	  INSERT (scope, description, icon, allow_dyn_reg, default_scope) VALUES(vals.scope, vals.description, vals.icon, vals.allow_dyn_reg, vals.default_scope); | ||||
| 	  INSERT (scope, description, icon, allow_dyn_reg, default_scope, structured, structured_param_description) VALUES(vals.scope, vals.description, vals.icon, vals.allow_dyn_reg, vals.default_scope, vals.structured, vals.structured_param_description); | ||||
| 
 | ||||
| COMMIT; | ||||
| 
 | ||||
|  |  | |||
|  | @ -70,5 +70,7 @@ CREATE TEMPORARY TABLE IF NOT EXISTS system_scope_TEMP ( | |||
| 	description VARCHAR(4096), | ||||
| 	icon VARCHAR(256), | ||||
| 	allow_dyn_reg BOOLEAN, | ||||
| 	default_scope BOOLEAN | ||||
| 	default_scope BOOLEAN, | ||||
| 	structured BOOLEAN, | ||||
| 	structured_param_description VARCHAR(256) | ||||
| ); | ||||
		Loading…
	
		Reference in New Issue
	
	 Justin Richer
						Justin Richer