ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prad...@apache.org
Subject [3/3] ranger git commit: RANGER-1490 : Increase size of sort_order column of x_policy_resource_map
Date Tue, 25 Apr 2017 22:23:30 GMT
RANGER-1490 : Increase size of sort_order column of x_policy_resource_map


Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/37667d7f
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/37667d7f
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/37667d7f

Branch: refs/heads/master
Commit: 37667d7faf87ec0000e5d236a19891046d66f1c1
Parents: ac24f70
Author: pradeep <pradeep@apache.org>
Authored: Fri Apr 21 14:11:55 2017 +0530
Committer: pradeep <pradeep@apache.org>
Committed: Wed Apr 26 03:52:20 2017 +0530

----------------------------------------------------------------------
 .../mysql/patches/027-sortorder-column-size.sql | 30 ++++++++++++++++++++
 .../patches/027-sortorder-column-size.sql       | 29 +++++++++++++++++++
 .../patches/027-sortorder-column-size.sql       | 28 ++++++++++++++++++
 .../patches/027-sortorder-column-size.sql       | 22 ++++++++++++++
 .../patches/027-sortorder-column-size.sql       | 30 ++++++++++++++++++++
 5 files changed, 139 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/37667d7f/security-admin/db/mysql/patches/027-sortorder-column-size.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/mysql/patches/027-sortorder-column-size.sql b/security-admin/db/mysql/patches/027-sortorder-column-size.sql
new file mode 100644
index 0000000..a547874
--- /dev/null
+++ b/security-admin/db/mysql/patches/027-sortorder-column-size.sql
@@ -0,0 +1,30 @@
+-- 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 change_sort_order_column_datatype_of_resourcemap_table;
+
+delimiter ;;
+create procedure change_sort_order_column_datatype_of_resourcemap_table() begin
+DECLARE loginID bigint(20);
+ /* check tables exist or not */
+	if exists (select * from information_schema.columns where table_schema=database() and table_name
= 'x_policy_resource_map' and column_name = 'sort_order' and data_type='tinyint') then
+		ALTER TABLE  `x_policy_resource_map` MODIFY COLUMN sort_order INT DEFAULT 0;
+	end if;
+end;;
+
+delimiter ;
+call change_sort_order_column_datatype_of_resourcemap_table();
+
+drop procedure if exists change_sort_order_column_datatype_of_resourcemap_table;

http://git-wip-us.apache.org/repos/asf/ranger/blob/37667d7f/security-admin/db/oracle/patches/027-sortorder-column-size.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/oracle/patches/027-sortorder-column-size.sql b/security-admin/db/oracle/patches/027-sortorder-column-size.sql
new file mode 100644
index 0000000..d07ffe8
--- /dev/null
+++ b/security-admin/db/oracle/patches/027-sortorder-column-size.sql
@@ -0,0 +1,29 @@
+-- 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_column_exists1 number:=0;
+BEGIN
+  Select count(*) into v_column_exists1
+    from user_tab_cols
+    where (column_name = upper('sort_order'))
+      and table_name = upper('x_policy_resource_map') and DATA_TYPE='NUMBER' and DATA_PRECISION=3;
+
+  if (v_column_exists1 = 1) then
+      execute immediate 'ALTER TABLE x_policy_resource_map MODIFY(sort_order NUMBER(10) DEFAULT
0)';
+      commit;
+  end if;
+end;/
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ranger/blob/37667d7f/security-admin/db/postgres/patches/027-sortorder-column-size.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/postgres/patches/027-sortorder-column-size.sql b/security-admin/db/postgres/patches/027-sortorder-column-size.sql
new file mode 100644
index 0000000..f52779b
--- /dev/null
+++ b/security-admin/db/postgres/patches/027-sortorder-column-size.sql
@@ -0,0 +1,28 @@
+-- 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 change_sort_order_column_datatype_of_resourcemap_tables() 
+RETURNS void AS $$
+DECLARE
+ v_column_exists1 integer := 0;
+BEGIN
+ select count(*) into v_column_exists1 from pg_attribute where attrelid in(select oid from
pg_class where relname='x_policy_resource_map') and attname='sort_order' and attlen=2;
+ IF v_column_exists1 = 1 THEN
+  ALTER TABLE x_policy_resource_map ALTER COLUMN sort_order TYPE INT;
+ END IF;
+END;
+$$ LANGUAGE plpgsql;
+select change_sort_order_column_datatype_of_resourcemap_tables();
+select 'delimiter end';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ranger/blob/37667d7f/security-admin/db/sqlanywhere/patches/027-sortorder-column-size.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/sqlanywhere/patches/027-sortorder-column-size.sql b/security-admin/db/sqlanywhere/patches/027-sortorder-column-size.sql
new file mode 100644
index 0000000..604c8ab
--- /dev/null
+++ b/security-admin/db/sqlanywhere/patches/027-sortorder-column-size.sql
@@ -0,0 +1,22 @@
+-- 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.
+
+BEGIN
+	IF EXISTS(select * from SYS.SYSCOLUMNS where tname = 'x_policy_resource_map' and cname='sort_order'
and coltype='tinyint') THEN
+		ALTER TABLE dbo.x_policy_resource_map ALTER sort_order INT DEFAULT 0 NULL;
+	END IF;
+END
+GO
+exit

http://git-wip-us.apache.org/repos/asf/ranger/blob/37667d7f/security-admin/db/sqlserver/patches/027-sortorder-column-size.sql
----------------------------------------------------------------------
diff --git a/security-admin/db/sqlserver/patches/027-sortorder-column-size.sql b/security-admin/db/sqlserver/patches/027-sortorder-column-size.sql
new file mode 100644
index 0000000..605ab6a
--- /dev/null
+++ b/security-admin/db/sqlserver/patches/027-sortorder-column-size.sql
@@ -0,0 +1,30 @@
+-- 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 EXISTS(select * from INFORMATION_SCHEMA.columns where table_name = 'x_policy_resource_map'
and column_name = 'sort_order' and DATA_TYPE='tinyint')
+BEGIN
+	DECLARE @ObjectName VARCHAR(100);
+	SELECT @ObjectName = OBJECT_NAME([default_object_id]) FROM SYS.COLUMNS WHERE [object_id]
= OBJECT_ID('[dbo].[x_policy_resource_map]') AND [name] = 'sort_order';
+	IF @ObjectName IS NOT NULL
+	BEGIN
+		EXEC('ALTER TABLE [dbo].[x_policy_resource_map] DROP CONSTRAINT ' + @ObjectName)
+	END
+	IF NOT EXISTS(select name from SYS.sysobjects where parent_obj in (select id from SYS.sysobjects
where name='x_policy_resource_map') and name=@ObjectName)
+	BEGIN
+		ALTER TABLE [dbo].[x_policy_resource_map] ALTER COLUMN [sort_order] [int]
+	END
+END
+GO
+exit


Mime
View raw message