RANGER-2691: Fix MsSQL syntax in patch
Signed-off-by: Mehul Parikh <mehul@apache.org>
diff --git a/security-admin/db/sqlserver/patches/035-update-schema-for-x-policy.sql b/security-admin/db/sqlserver/patches/035-update-schema-for-x-policy.sql
index 5b3ea05..1afb2ae 100644
--- a/security-admin/db/sqlserver/patches/035-update-schema-for-x-policy.sql
+++ b/security-admin/db/sqlserver/patches/035-update-schema-for-x-policy.sql
@@ -447,25 +447,24 @@
IF EXISTS(select name from x_service_def where name like 'atlas.%')
BEGIN
DECLARE @new_atlas_def_name VARCHAR(100);
- set @new_atlas_def_name=(select name into new_atlas_def_name from x_service_def where name like 'atlas.%')
+ set @new_atlas_def_name=(select name from x_service_def where name like 'atlas.%')
IF EXISTS(select * from x_access_type_def where def_id in(select id from x_service_def where name='tag') and name in('atlas:read','atlas:create','atlas:update','atlas:delete','atlas:all'))
BEGIN
- update x_access_type_def set name=concat(new_atlas_def_name , ':read') where def_id=100 and name='atlas:read';
- update x_access_type_def set name=concat(new_atlas_def_name , ':create') where def_id=100 and name='atlas:create';
- update x_access_type_def set name=concat(new_atlas_def_name , ':update') where def_id=100 and name='atlas:update';
- update x_access_type_def set name=concat(new_atlas_def_name , ':delete') where def_id=100 and name='atlas:delete';
- update x_access_type_def set name=concat(new_atlas_def_name , ':all') where def_id=100 and name='atlas:all';
- END IF;
+ update x_access_type_def set name=concat(@new_atlas_def_name , ':read') where def_id=100 and name='atlas:read';
+ update x_access_type_def set name=concat(@new_atlas_def_name , ':create') where def_id=100 and name='atlas:create';
+ update x_access_type_def set name=concat(@new_atlas_def_name , ':update') where def_id=100 and name='atlas:update';
+ update x_access_type_def set name=concat(@new_atlas_def_name , ':delete') where def_id=100 and name='atlas:delete';
+ update x_access_type_def set name=concat(@new_atlas_def_name , ':all') where def_id=100 and name='atlas:all';
+ END
IF EXISTS(select * from x_access_type_def_grants where atd_id in (select id from x_access_type_def where def_id in (select id from x_service_def where name='tag') and name like 'atlas%') and implied_grant in ('atlas:read','atlas:create','atlas:update','atlas:delete','atlas:all'))
BEGIN
- update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':read') where implied_grant='atlas:read';
- update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':create') where implied_grant='atlas:create';
- update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':update') where implied_grant='atlas:update';
- update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':delete') where implied_grant='atlas:delete';
- update x_access_type_def_grants set implied_grant=concat(new_atlas_def_name , ':all') where implied_grant='atlas:all';
- END IF;
- END IF;
-END IF;
+ update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':read') where implied_grant='atlas:read';
+ update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':create') where implied_grant='atlas:create';
+ update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':update') where implied_grant='atlas:update';
+ update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':delete') where implied_grant='atlas:delete';
+ update x_access_type_def_grants set implied_grant=concat(@new_atlas_def_name , ':all') where implied_grant='atlas:all';
+ END
+ END
END
GO
EXIT
\ No newline at end of file