Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9A684200C73 for ; Wed, 26 Apr 2017 00:23:30 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 99224160BB9; Tue, 25 Apr 2017 22:23:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BD884160BB8 for ; Wed, 26 Apr 2017 00:23:29 +0200 (CEST) Received: (qmail 18060 invoked by uid 500); 25 Apr 2017 22:23:29 -0000 Mailing-List: contact commits-help@ranger.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ranger.apache.org Delivered-To: mailing list commits@ranger.apache.org Received: (qmail 18030 invoked by uid 99); 25 Apr 2017 22:23:28 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Apr 2017 22:23:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C6F8BDFC4A; Tue, 25 Apr 2017 22:23:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pradeep@apache.org To: commits@ranger.apache.org Date: Tue, 25 Apr 2017 22:23:30 -0000 Message-Id: In-Reply-To: <913b21a2392841d4b0cf6a7ecc6b3f2e@git.apache.org> References: <913b21a2392841d4b0cf6a7ecc6b3f2e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/3] ranger git commit: RANGER-1490 : Increase size of sort_order column of x_policy_resource_map archived-at: Tue, 25 Apr 2017 22:23:30 -0000 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 Authored: Fri Apr 21 14:11:55 2017 +0530 Committer: pradeep 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