This is an automated email from the ASF dual-hosted git repository.

mehul pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/master by this push:
     new 22168d1  RANGER-2641 : Upgrade scenario fails in MYSQL DB
22168d1 is described below

commit 22168d1b0bdf51e1317447cafddeb0f60af10810
Author: Kishor Gollapalliwar <kishor.gollapalli...@gmail.com>
AuthorDate: Fri Nov 15 18:35:40 2019 +0530

    RANGER-2641 : Upgrade scenario fails in MYSQL DB
    
    Signed-off-by: Mehul Parikh <me...@apache.org>
---
 ...playName-col-in-x_service_def_and_x_service.sql | 37 --------------------
 ...044-add-role-version-in-serviceVersionInfo.sql} | 21 ++++++------
 ...layName-col-in-x_service_def_and_x_service.sql} | 24 +++++++++++++
 ...playName-col-in-x_service_def_and_x_service.sql | 33 ------------------
 ...044-add-role-version-in-serviceVersionInfo.sql} |  0
 ...layName-col-in-x_service_def_and_x_service.sql} | 20 +++++++++--
 ...playName-col-in-x_service_def_and_x_service.sql | 40 ----------------------
 ...044-add-role-version-in-serviceVersionInfo.sql} |  4 +--
 ...layName-col-in-x_service_def_and_x_service.sql} | 30 ++++++++++++++++
 ...playName-col-in-x_service_def_and_x_service.sql | 27 ---------------
 ...044-add-role-version-in-serviceVersionInfo.sql} |  0
 ...layName-col-in-x_service_def_and_x_service.sql} | 20 ++++++++++-
 ...playName-col-in-x_service_def_and_x_service.sql | 30 ----------------
 ...044-add-role-version-in-serviceVersionInfo.sql} |  7 ++--
 ...layName-col-in-x_service_def_and_x_service.sql} | 23 ++++++++++++-
 15 files changed, 129 insertions(+), 187 deletions(-)

diff --git 
a/security-admin/db/mysql/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
 
b/security-admin/db/mysql/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
deleted file mode 100644
index b552c42..0000000
--- 
a/security-admin/db/mysql/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
+++ /dev/null
@@ -1,37 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements.  See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License.  You may obtain a copy of the License at
---
---     http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-drop procedure if exists add_column_in_x_service_def_and_x_service;
-
-delimiter ;;
-create procedure add_column_in_x_service_def_and_x_service() begin
-
-if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_service_def' and 
column_name='display_name') then
-        ALTER TABLE x_service_def ADD display_name varchar(1024) DEFAULT NULL;
-        UPDATE x_service_def SET display_name=name;
-        UPDATE x_service_def SET display_name='Hadoop SQL' where name='hive';
-end if;
-
-if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_service' and 
column_name='display_name') then
-        ALTER TABLE x_service ADD display_name varchar(255) DEFAULT NULL;
-        UPDATE x_service SET display_name = name;
-end if;
-
-end;;
-
-delimiter ;
-call add_column_in_x_service_def_and_x_service();
-
-drop procedure if exists add_column_in_x_service_def_and_x_service;
\ No newline at end of file
diff --git 
a/security-admin/db/mysql/patches/043-add-role-version-in-serviceVersionInfo.sql
 
b/security-admin/db/mysql/patches/044-add-role-version-in-serviceVersionInfo.sql
similarity index 51%
rename from 
security-admin/db/mysql/patches/043-add-role-version-in-serviceVersionInfo.sql
rename to 
security-admin/db/mysql/patches/044-add-role-version-in-serviceVersionInfo.sql
index def5678..bf0d0f6 100644
--- 
a/security-admin/db/mysql/patches/043-add-role-version-in-serviceVersionInfo.sql
+++ 
b/security-admin/db/mysql/patches/044-add-role-version-in-serviceVersionInfo.sql
@@ -13,22 +13,21 @@
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 
-drop procedure if exists add-role-version-in-serviceVersionInfo;
+drop procedure if exists add_role_version_in_serviceVersionInfo;
 
 delimiter ;;
-create procedure add-role-version-in-serviceVersionInfo() begin
+create procedure add_role_version_in_serviceVersionInfo() begin
 
-if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_service_version_info' and 
column_name='role_version') then
-        ALTER TABLE x_service_version_info ADD role_version bigint(20) NOT 
NULL DEFAULT 0;
-end if;
-end;;
+       if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_service_version_info' and 
column_name='role_version') then
+               ALTER TABLE x_service_version_info ADD role_version bigint(20) 
NOT NULL DEFAULT 0;
+       end if;
 
-if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_service_version_info' and 
column_name='role_update_time') then
-        ALTER TABLE x_service_version_info ADD role_update_time datetime NULL 
DEFAULT NULL;
-end if;
+       if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_service_version_info' and 
column_name='role_update_time') then
+               ALTER TABLE x_service_version_info ADD role_update_time 
datetime NULL DEFAULT NULL;
+       end if;
 end;;
 
 delimiter ;
-call add-role-version-in-serviceVersionInfo();
+call add_role_version_in_serviceVersionInfo();
 
-drop procedure if exists add-role-version-in-serviceVersionInfo;
+drop procedure if exists add_role_version_in_serviceVersionInfo;
diff --git 
a/security-admin/db/mysql/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
 
b/security-admin/db/mysql/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
similarity index 65%
rename from 
security-admin/db/mysql/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
rename to 
security-admin/db/mysql/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
index fa9bd1a..a23976b 100644
--- 
a/security-admin/db/mysql/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
+++ 
b/security-admin/db/mysql/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
@@ -13,6 +13,30 @@
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 
+drop procedure if exists add_column_in_x_service_def_and_x_service;
+
+delimiter ;;
+create procedure add_column_in_x_service_def_and_x_service() begin
+
+if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_service_def' and 
column_name='display_name') then
+        ALTER TABLE x_service_def ADD display_name varchar(1024) DEFAULT NULL;
+        UPDATE x_service_def SET display_name=name;
+        UPDATE x_service_def SET display_name='Hadoop SQL' where name='hive';
+end if;
+
+if not exists (select * from information_schema.columns where 
table_schema=database() and table_name = 'x_service' and 
column_name='display_name') then
+        ALTER TABLE x_service ADD display_name varchar(255) DEFAULT NULL;
+        UPDATE x_service SET display_name = name;
+end if;
+
+end;;
+
+delimiter ;
+call add_column_in_x_service_def_and_x_service();
+
+drop procedure if exists add_column_in_x_service_def_and_x_service;
+
+-- User changes
 drop procedure if exists add_column_in_x_user_and_x_portal_user_and_x_group;
 
 delimiter ;;
diff --git 
a/security-admin/db/oracle/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
 
b/security-admin/db/oracle/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
deleted file mode 100644
index 0d634c6..0000000
--- 
a/security-admin/db/oracle/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
+++ /dev/null
@@ -1,33 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements.  See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License.  You may obtain a copy of the License at
---
---     http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DECLARE
-        v_count number:=0;
-BEGIN
-        select count(*) into v_count from user_tab_cols where 
table_name='x_service_def' and column_name='display_name';
-        if (v_count = 0) then
-                execute immediate 'ALTER TABLE x_service_def ADD display_name 
VARCHAR(1024) DEFAULT NULL NULL';
-                execute immediate 'UPDATE x_service_def SET display_name=name';
-                execute immediate 'UPDATE x_service_def SET display_name=:val 
where name=:searchVal' using 'Hadoop SQL', 'hive';
-        end if;
-
-        v_count number:=0;
-        select count(*) into v_count from user_tab_cols where 
table_name='x_service' and column_name='display_name';
-        if (v_count = 0) then
-                execute immediate 'ALTER TABLE x_service ADD display_name 
VARCHAR(255) DEFAULT NULL NULL';
-                execute immediate 'UPDATE x_service SET display_name=name';
-        end if;
-        commit;
-END;/
\ No newline at end of file
diff --git 
a/security-admin/db/oracle/patches/043-add-role-version-in-serviceVersionInfo.sql
 
b/security-admin/db/oracle/patches/044-add-role-version-in-serviceVersionInfo.sql
similarity index 100%
rename from 
security-admin/db/oracle/patches/043-add-role-version-in-serviceVersionInfo.sql
rename to 
security-admin/db/oracle/patches/044-add-role-version-in-serviceVersionInfo.sql
diff --git 
a/security-admin/db/oracle/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
 
b/security-admin/db/oracle/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
similarity index 64%
rename from 
security-admin/db/oracle/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
rename to 
security-admin/db/oracle/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
index 01ad187..54c5944 100644
--- 
a/security-admin/db/oracle/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
+++ 
b/security-admin/db/oracle/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
@@ -16,18 +16,34 @@
 DECLARE
         v_count number:=0;
 BEGIN
+        select count(*) into v_count from user_tab_cols where 
table_name='x_service_def' and column_name='display_name';
+        if (v_count = 0) then
+                execute immediate 'ALTER TABLE x_service_def ADD display_name 
VARCHAR(1024) DEFAULT NULL NULL';
+                execute immediate 'UPDATE x_service_def SET display_name=name';
+                execute immediate 'UPDATE x_service_def SET display_name=:val 
where name=:searchVal' using 'Hadoop SQL', 'hive';
+        end if;
+
+        v_count:=0;
+        select count(*) into v_count from user_tab_cols where 
table_name='x_service' and column_name='display_name';
+        if (v_count = 0) then
+                execute immediate 'ALTER TABLE x_service ADD display_name 
VARCHAR(255) DEFAULT NULL NULL';
+                execute immediate 'UPDATE x_service SET display_name=name';
+        end if;
+        commit;
+
+        v_count:=0;
         select count(*) into v_count from user_tab_cols where 
table_name='x_portal_user' and column_name='other_attributes';
         if (v_count = 0) then
                 execute immediate 'ALTER TABLE x_portal_user ADD 
other_attributes VARCHAR(4000) DEFAULT NULL NULL';
         end if;
 
-        v_count number:=0;
+        v_count:=0;
         select count(*) into v_count from user_tab_cols where 
table_name='x_user' and column_name='other_attributes';
         if (v_count = 0) then
                 execute immediate 'ALTER TABLE x_user ADD other_attributes 
VARCHAR(4000) DEFAULT NULL NULL';
         end if;
 
-        v_count number:=0;
+        v_count:=0;
         select count(*) into v_count from user_tab_cols where 
table_name='X_GROUP' and column_name='other_attributes';
         if (v_count = 0) then
                 execute immediate 'ALTER TABLE X_GROUP ADD other_attributes 
VARCHAR(4000) DEFAULT NULL NULL';
diff --git 
a/security-admin/db/postgres/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
 
b/security-admin/db/postgres/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
deleted file mode 100644
index 2f31685..0000000
--- 
a/security-admin/db/postgres/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
+++ /dev/null
@@ -1,40 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements.  See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License.  You may obtain a copy of the License at
---
---     http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-select 'delimiter start';
-CREATE OR REPLACE FUNCTION add_col_in_x_service_def_and_x_service()
-RETURNS void AS $$
-DECLARE
- v_column_exists integer := 0;
-BEGIN
- select count(*) into v_column_exists from pg_attribute where attrelid 
in(select oid from pg_class where relname='x_service_def') and 
attname='display_name';
- IF v_column_exists = 0 THEN
-  ALTER TABLE x_service_def ADD COLUMN display_name VARCHAR(1024) DEFAULT NULL 
NULL;
-  UPDATE x_service_def SET display_name=name;
-  UPDATE x_service_def SET display_name='Hadoop SQL' where name='hive';
- END IF;
-
- select count(*) into v_column_exists from pg_attribute where attrelid 
in(select oid from pg_class where relname='x_service') and 
attname='display_name';
- IF v_column_exists = 0 THEN
-  ALTER TABLE x_service ADD COLUMN display_name VARCHAR(255) DEFAULT NULL NULL;
-  UPDATE x_service SET display_name=name;
- END IF;
-
-END;
-$$ LANGUAGE plpgsql;
-select 'delimiter end';
-
-select add_col_in_x_service_def_and_x_service();
-select 'delimiter end';
\ No newline at end of file
diff --git 
a/security-admin/db/postgres/patches/043-add-role-version-in-serviceVersionInfo.sql
 
b/security-admin/db/postgres/patches/044-add-role-version-in-serviceVersionInfo.sql
similarity index 93%
rename from 
security-admin/db/postgres/patches/043-add-role-version-in-serviceVersionInfo.sql
rename to 
security-admin/db/postgres/patches/044-add-role-version-in-serviceVersionInfo.sql
index 4801ec3..f4bae35 100644
--- 
a/security-admin/db/postgres/patches/043-add-role-version-in-serviceVersionInfo.sql
+++ 
b/security-admin/db/postgres/patches/044-add-role-version-in-serviceVersionInfo.sql
@@ -15,7 +15,7 @@
 
 -- function add-role-version-in-serviceVersionInfo
 select 'delimiter start';
-CREATE OR REPLACE FUNCTION add-role-version-in-serviceVersionInfo()
+CREATE OR REPLACE FUNCTION add_role_version_in_serviceVersionInfo()
 RETURNS void AS $$
 DECLARE
  v_column_exists integer := 0;
@@ -32,5 +32,5 @@ END;
 $$ LANGUAGE plpgsql;
 select 'delimiter end';
 
-select add-role-version-in-serviceVersionInfo();
+select add_role_version_in_serviceVersionInfo();
 select 'delimiter end';
diff --git 
a/security-admin/db/postgres/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
 
b/security-admin/db/postgres/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
similarity index 63%
rename from 
security-admin/db/postgres/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
rename to 
security-admin/db/postgres/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
index 4962891..b1e8c38 100644
--- 
a/security-admin/db/postgres/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
+++ 
b/security-admin/db/postgres/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
@@ -14,6 +14,34 @@
 -- limitations under the License.
 
 select 'delimiter start';
+CREATE OR REPLACE FUNCTION add_col_in_x_service_def_and_x_service()
+RETURNS void AS $$
+DECLARE
+ v_column_exists integer := 0;
+BEGIN
+ select count(*) into v_column_exists from pg_attribute where attrelid 
in(select oid from pg_class where relname='x_service_def') and 
attname='display_name';
+ IF v_column_exists = 0 THEN
+  ALTER TABLE x_service_def ADD COLUMN display_name VARCHAR(1024) DEFAULT NULL 
NULL;
+  UPDATE x_service_def SET display_name=name;
+  UPDATE x_service_def SET display_name='Hadoop SQL' where name='hive';
+ END IF;
+
+ v_column_exists:=0;
+ select count(*) into v_column_exists from pg_attribute where attrelid 
in(select oid from pg_class where relname='x_service') and 
attname='display_name';
+ IF v_column_exists = 0 THEN
+  ALTER TABLE x_service ADD COLUMN display_name VARCHAR(255) DEFAULT NULL NULL;
+  UPDATE x_service SET display_name=name;
+ END IF;
+
+END;
+$$ LANGUAGE plpgsql;
+select 'delimiter end';
+
+select add_col_in_x_service_def_and_x_service();
+select 'delimiter end';
+commit;
+
+select 'delimiter start';
 CREATE OR REPLACE FUNCTION add_column_in_x_user_and_x_portal_user_and_x_group()
 RETURNS void AS $$
 DECLARE
@@ -24,11 +52,13 @@ BEGIN
   ALTER TABLE x_portal_user ADD COLUMN other_attributes VARCHAR(4000) DEFAULT 
NULL NULL;
  END IF;
 
+ v_column_exists:=0;
  select count(*) into v_column_exists from pg_attribute where attrelid 
in(select oid from pg_class where relname='x_user') and 
attname='other_attributes';
  IF v_column_exists = 0 THEN
   ALTER TABLE x_user ADD COLUMN other_attributes VARCHAR(4000) DEFAULT NULL 
NULL;
  END IF;
 
+ v_column_exists:=0;
  select count(*) into v_column_exists from pg_attribute where attrelid 
in(select oid from pg_class where relname='x_group') and 
attname='other_attributes';
  IF v_column_exists = 0 THEN
   ALTER TABLE x_group ADD COLUMN other_attributes VARCHAR(4000) DEFAULT NULL 
NULL;
diff --git 
a/security-admin/db/sqlanywhere/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
 
b/security-admin/db/sqlanywhere/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
deleted file mode 100644
index 76bb780..0000000
--- 
a/security-admin/db/sqlanywhere/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
+++ /dev/null
@@ -1,27 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements.  See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License.  You may obtain a copy of the License at
---
---     http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_service_def' and 
cname = 'display_name') THEN
-               ALTER TABLE dbo.x_service_def ADD display_name varchar(1024) 
DEFAULT NULL NULL;
-               UPDATE dbo.x_service_def SET display_name=name;
-               UPDATE dbo.x_service_def SET display_name='Hadoop SQL' where 
name='hive';
-END IF;
-GO
-IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_service' and cname 
= 'display_name') THEN
-               ALTER TABLE dbo.x_service ADD display_name varchar(255) DEFAULT 
NULL NULL;
-               UPDATE dbo.x_service SET display_name=name;
-END IF;
-GO
-exit
\ No newline at end of file
diff --git 
a/security-admin/db/sqlanywhere/patches/043-add-role-version-in-serviceVersionInfo.sql
 
b/security-admin/db/sqlanywhere/patches/044-add-role-version-in-serviceVersionInfo.sql
similarity index 100%
rename from 
security-admin/db/sqlanywhere/patches/043-add-role-version-in-serviceVersionInfo.sql
rename to 
security-admin/db/sqlanywhere/patches/044-add-role-version-in-serviceVersionInfo.sql
diff --git 
a/security-admin/db/sqlanywhere/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
 
b/security-admin/db/sqlanywhere/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
similarity index 61%
rename from 
security-admin/db/sqlanywhere/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
rename to 
security-admin/db/sqlanywhere/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
index a70bf9d..38a85e9 100644
--- 
a/security-admin/db/sqlanywhere/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
+++ 
b/security-admin/db/sqlanywhere/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
@@ -13,6 +13,24 @@
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 
+IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_service_def' and 
cname = 'display_name') THEN
+               ALTER TABLE dbo.x_service_def ADD display_name varchar(1024) 
DEFAULT NULL NULL;
+END IF;
+GO
+IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_service' and cname 
= 'display_name') THEN
+               ALTER TABLE dbo.x_service ADD display_name varchar(255) DEFAULT 
NULL NULL;
+END IF;
+GO
+IF EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_service_def' and cname 
= 'display_name') THEN
+               UPDATE dbo.x_service_def SET display_name=name WHERE 
display_name IS NULL AND name <> 'hive';
+               UPDATE dbo.x_service_def SET display_name='Hadoop SQL' WHERE 
name='hive' AND display_name IS NULL;
+END IF;
+GO
+IF EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_service' and cname = 
'display_name') THEN
+               UPDATE dbo.x_service SET display_name=name WHERE display_name 
IS NULL;
+END IF;
+GO
+
 IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_portal_user' and 
cname = 'other_attributes') THEN
                ALTER TABLE dbo.x_portal_user ADD other_attributes 
varchar(4000) DEFAULT NULL NULL;
 END IF;
@@ -25,4 +43,4 @@ IF NOT EXISTS(select * from SYS.SYSCOLUMNS where tname = 
'x_group' and cname = '
                ALTER TABLE dbo.x_group ADD other_attributes varchar(4000) 
DEFAULT NULL NULL;
 END IF;
 GO
-exit
\ No newline at end of file
+exit
diff --git 
a/security-admin/db/sqlserver/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
 
b/security-admin/db/sqlserver/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
deleted file mode 100644
index 2d47927..0000000
--- 
a/security-admin/db/sqlserver/patches/044-add-displayName-col-in-x_service_def_and_x_service.sql
+++ /dev/null
@@ -1,30 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements.  See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to You under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License.  You may obtain a copy of the License at
---
---     http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-GO
-IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_service_def' and column_name = 'display_name')
-BEGIN
-       ALTER TABLE [dbo].[x_service_def] ADD [display_name] [varchar](1024) 
DEFAULT NULL NULL;
-       UPDATE [dbo].[x_service_def] SET [display_name] = [name];
-       UPDATE [dbo].[x_service_def] SET [display_name] = 'Hadoop SQL' where 
[name] = 'hive';
-END
-GO
-IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_service' and column_name = 'display_name')
-BEGIN
-       ALTER TABLE [dbo].[x_service] ADD [display_name] [varchar](255) DEFAULT 
NULL NULL;
-       UPDATE [dbo].[x_service] SET [display_name] = [name];
-END
-GO
-exit
\ No newline at end of file
diff --git 
a/security-admin/db/sqlserver/patches/042-add-role-version-in-serviceVersionInfo.sql
 
b/security-admin/db/sqlserver/patches/044-add-role-version-in-serviceVersionInfo.sql
similarity index 81%
rename from 
security-admin/db/sqlserver/patches/042-add-role-version-in-serviceVersionInfo.sql
rename to 
security-admin/db/sqlserver/patches/044-add-role-version-in-serviceVersionInfo.sql
index 4f9b379..ac8412a 100644
--- 
a/security-admin/db/sqlserver/patches/042-add-role-version-in-serviceVersionInfo.sql
+++ 
b/security-admin/db/sqlserver/patches/044-add-role-version-in-serviceVersionInfo.sql
@@ -14,13 +14,14 @@
 -- limitations under the License.
 
 GO
-IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_service_version_info' and column_name = 'role_version')
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where 
table_name='x_service_version_info' and column_name='role_version')
 BEGIN
-       ALTER TABLE [dbo].[x_service_version_info] ADD [policy_version] 
[bigint] NOT NULL DEFAULT 0;
+       ALTER TABLE [dbo].[x_service_version_info] ADD [role_version] [bigint] 
DEFAULT 0 NOT NULL;
 END
 GO
+
 GO
-IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_service_version_info' and column_name = 'role_update_time')
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where 
table_name='x_service_version_info' and column_name='role_update_time')
 BEGIN
        ALTER TABLE [dbo].[x_service_version_info] ADD [role_update_time] 
[datetime2] DEFAULT NULL NULL;
 END
diff --git 
a/security-admin/db/sqlserver/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
 
b/security-admin/db/sqlserver/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
similarity index 59%
rename from 
security-admin/db/sqlserver/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
rename to 
security-admin/db/sqlserver/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
index 6bd0ff9..ae21644 100644
--- 
a/security-admin/db/sqlserver/patches/045-add-otherAttributes-col-in-x_user-x_portal_user-x_group.sql
+++ 
b/security-admin/db/sqlserver/patches/045-add-displayName-col-in-x_service_def_and_x_service.sql
@@ -14,6 +14,27 @@
 -- limitations under the License.
 
 GO
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_service_def' and column_name = 'display_name')
+BEGIN
+       ALTER TABLE [dbo].[x_service_def] ADD [display_name] [varchar](1024) 
DEFAULT NULL NULL;
+END
+GO
+IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_service' and column_name = 'display_name')
+BEGIN
+       ALTER TABLE [dbo].[x_service] ADD [display_name] [varchar](255) DEFAULT 
NULL NULL;
+END
+GO
+IF EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_service_def' and column_name = 'display_name')
+BEGIN
+       UPDATE [dbo].[x_service_def] SET [display_name] = [name] WHERE 
[display_name] IS NULL AND [name] <> 'hive';
+       UPDATE [dbo].[x_service_def] SET [display_name] = 'Hadoop SQL' where 
[name] = 'hive' AND [display_name] IS NULL;
+END
+GO
+IF EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_service' and column_name = 'display_name')
+BEGIN
+       UPDATE [dbo].[x_service] SET [display_name] = [name] WHERE 
[display_name] IS NULL;
+END
+GO
 IF NOT EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 
'x_portal_user' and column_name = 'other_attributes')
 BEGIN
        ALTER TABLE [dbo].[x_portal_user] ADD [other_attributes] 
[varchar](4000) DEFAULT NULL NULL;
@@ -29,4 +50,4 @@ BEGIN
        ALTER TABLE [dbo].[x_group] ADD [other_attributes] [varchar](4000) 
DEFAULT NULL NULL;
 END
 GO
-exit
\ No newline at end of file
+exit

Reply via email to