ramackri commented on code in PR #1138:
URL: https://github.com/apache/ranger/pull/1138#discussion_r3954929478


##########
security-admin/db/sqlserver/patches/078-audit-partition-plan-global-state.sql:
##########
@@ -0,0 +1,98 @@
+-- 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.
+SET ANSI_NULLS ON
+GO
+SET QUOTED_IDENTIFIER ON
+GO
+IF EXISTS (SELECT *
+           FROM   sys.objects
+           WHERE  object_id = OBJECT_ID(N'dbo.getXportalUIdByLoginId')
+                  AND type IN ( N'FN', N'IF', N'TF', N'FS', N'FT' ))
+  DROP FUNCTION dbo.getXportalUIdByLoginId
+GO
+CREATE FUNCTION dbo.getXportalUIdByLoginId(@inputValue varchar(200))
+RETURNS int
+AS
+BEGIN
+        DECLARE @myid int;
+        SELECT @myid = id FROM x_portal_user WHERE x_portal_user.login_id = 
@inputValue;
+        RETURN @myid;
+END
+GO
+
+IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 
'x_audit_config')
+BEGIN
+    CREATE TABLE [dbo].[x_audit_config](
+        [id] [bigint] IDENTITY(1,1) NOT NULL,
+        [create_time] [datetime2] DEFAULT NULL NULL,
+        [update_time] [datetime2] DEFAULT NULL NULL,
+        [cfg_name] [varchar](255) NOT NULL,
+        [cfg_value] NVARCHAR(MAX) DEFAULT NULL NULL,
+        [version] [bigint] DEFAULT NULL NULL,
+        PRIMARY KEY CLUSTERED ([id] ASC),
+        CONSTRAINT [x_audit_config_UK_cfg_name] UNIQUE NONCLUSTERED 
([cfg_name] ASC)

Review Comment:
   Good catch @rameeshm 
    — updated the SQL Server patch to use CONSTRAINT 
[x_audit_config$x_audit_config_UK_cfg_name] to match the existing SQL Server 
convention. Fresh-install ranger_core_db_sqlserver.sql already had the correct 
name.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to