http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.4.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.4.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.4.0.sql deleted file mode 100644 index 5dfae03..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.4.0.sql +++ /dev/null @@ -1,124 +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. - -START TRANSACTION; - -SET statement_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = off; -SET check_function_bodies = false; -SET client_min_messages = warning; -SET escape_string_warning = off; -SET search_path = public, pg_catalog; -SET default_tablespace = ''; -SET default_with_oids = false; - -CREATE TABLE "SENTRY_DB_PRIVILEGE" ( - "DB_PRIVILEGE_ID" BIGINT NOT NULL, - "PRIVILEGE_NAME" character varying(4000) NOT NULL, - "PRIVILEGE_SCOPE" character varying(32) NOT NULL, - "SERVER_NAME" character varying(128) NOT NULL, - "DB_NAME" character varying(128) DEFAULT NULL::character varying, - "TABLE_NAME" character varying(128) DEFAULT NULL::character varying, - "URI" character varying(4000) DEFAULT NULL::character varying, - "ACTION" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" VARCHAR(128) NOT NULL -); - -CREATE TABLE "SENTRY_ROLE" ( - "ROLE_ID" BIGINT NOT NULL, - "ROLE_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) NOT NULL -); - -CREATE TABLE "SENTRY_GROUP" ( - "GROUP_ID" BIGINT NOT NULL, - "GROUP_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) NOT NULL -); - -CREATE TABLE "SENTRY_ROLE_DB_PRIVILEGE_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "DB_PRIVILEGE_ID" BIGINT NOT NULL -); - -CREATE TABLE "SENTRY_ROLE_GROUP_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "GROUP_ID" BIGINT NOT NULL -); - -CREATE TABLE "SENTRY_VERSION" ( - "VER_ID" bigint, - "SCHEMA_VERSION" character varying(127) NOT NULL, - "VERSION_COMMENT" character varying(255) NOT NULL -); - - -ALTER TABLE ONLY "SENTRY_DB_PRIVILEGE" - ADD CONSTRAINT "SENTRY_DB_PRIV_PK" PRIMARY KEY ("DB_PRIVILEGE_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE" - ADD CONSTRAINT "SENTRY_ROLE_PK" PRIMARY KEY ("ROLE_ID"); - -ALTER TABLE ONLY "SENTRY_GROUP" - ADD CONSTRAINT "SENTRY_GROUP_PK" PRIMARY KEY ("GROUP_ID"); - -ALTER TABLE ONLY "SENTRY_VERSION" ADD CONSTRAINT "SENTRY_VERSION_PK" PRIMARY KEY ("VER_ID"); - -ALTER TABLE ONLY "SENTRY_DB_PRIVILEGE" - ADD CONSTRAINT "SENTRY_DB_PRIV_PRIV_NAME_UNIQ" UNIQUE ("PRIVILEGE_NAME"); - -CREATE INDEX "SENTRY_PRIV_SERV_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("SERVER_NAME"); - -CREATE INDEX "SENTRY_PRIV_DB_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("DB_NAME"); - -CREATE INDEX "SENTRY_PRIV_TBL_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("TABLE_NAME"); - -CREATE INDEX "SENTRY_PRIV_URI_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("URI"); - -ALTER TABLE ONLY "SENTRY_ROLE" - ADD CONSTRAINT "SENTRY_ROLE_ROLE_NAME_UNIQUE" UNIQUE ("ROLE_NAME"); - -ALTER TABLE ONLY "SENTRY_GROUP" - ADD CONSTRAINT "SENTRY_GRP_GRP_NAME_UNIQUE" UNIQUE ("GROUP_NAME"); - -ALTER TABLE "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SENTRY_ROLE_DB_PRIVILEGE_MAP_PK" PRIMARY KEY ("ROLE_ID","DB_PRIVILEGE_ID"); - -ALTER TABLE "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SENTRY_ROLE_GROUP_MAP_PK" PRIMARY KEY ("ROLE_ID","GROUP_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RLE_DB_PRV_MAP_SN_RLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RL_DB_PRV_MAP_SN_DB_PRV_FK" - FOREIGN KEY ("DB_PRIVILEGE_ID") REFERENCES "SENTRY_DB_PRIVILEGE"("DB_PRIVILEGE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SEN_ROLE_GROUP_MAP_SEN_ROLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SEN_ROLE_GROUP_MAP_SEN_GRP_FK" - FOREIGN KEY ("GROUP_ID") REFERENCES "SENTRY_GROUP"("GROUP_ID") DEFERRABLE; - -INSERT INTO "SENTRY_VERSION" ("VER_ID", "SCHEMA_VERSION", "VERSION_COMMENT") VALUES (1, '1.4.0', 'Sentry release version 1.4.0'); - -COMMIT;
http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.5.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.5.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.5.0.sql deleted file mode 100644 index fb26770..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.5.0.sql +++ /dev/null @@ -1,182 +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. - -START TRANSACTION; - -SET statement_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = off; -SET check_function_bodies = false; -SET client_min_messages = warning; -SET escape_string_warning = off; -SET search_path = public, pg_catalog; -SET default_tablespace = ''; -SET default_with_oids = false; - -CREATE TABLE "SENTRY_DB_PRIVILEGE" ( - "DB_PRIVILEGE_ID" BIGINT NOT NULL, - "PRIVILEGE_SCOPE" character varying(32) NOT NULL, - "SERVER_NAME" character varying(128) NOT NULL, - "DB_NAME" character varying(128) DEFAULT '__NULL__', - "TABLE_NAME" character varying(128) DEFAULT '__NULL__', - "COLUMN_NAME" character varying(128) DEFAULT '__NULL__', - "URI" character varying(4000) DEFAULT '__NULL__', - "ACTION" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "WITH_GRANT_OPTION" CHAR(1) NOT NULL -); - -CREATE TABLE "SENTRY_ROLE" ( - "ROLE_ID" BIGINT NOT NULL, - "ROLE_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL -); - -CREATE TABLE "SENTRY_GROUP" ( - "GROUP_ID" BIGINT NOT NULL, - "GROUP_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL -); - -CREATE TABLE "SENTRY_ROLE_DB_PRIVILEGE_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "DB_PRIVILEGE_ID" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) -); - -CREATE TABLE "SENTRY_ROLE_GROUP_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "GROUP_ID" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) -); - -CREATE TABLE "SENTRY_VERSION" ( - "VER_ID" bigint, - "SCHEMA_VERSION" character varying(127) NOT NULL, - "VERSION_COMMENT" character varying(255) NOT NULL -); - - -ALTER TABLE ONLY "SENTRY_DB_PRIVILEGE" - ADD CONSTRAINT "SENTRY_DB_PRIV_PK" PRIMARY KEY ("DB_PRIVILEGE_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE" - ADD CONSTRAINT "SENTRY_ROLE_PK" PRIMARY KEY ("ROLE_ID"); - -ALTER TABLE ONLY "SENTRY_GROUP" - ADD CONSTRAINT "SENTRY_GROUP_PK" PRIMARY KEY ("GROUP_ID"); - -ALTER TABLE ONLY "SENTRY_VERSION" ADD CONSTRAINT "SENTRY_VERSION_PK" PRIMARY KEY ("VER_ID"); - -ALTER TABLE ONLY "SENTRY_DB_PRIVILEGE" - ADD CONSTRAINT "SENTRY_DB_PRIV_PRIV_NAME_UNIQ" UNIQUE ("SERVER_NAME","DB_NAME","TABLE_NAME","COLUMN_NAME","URI", "ACTION","WITH_GRANT_OPTION"); - -CREATE INDEX "SENTRY_PRIV_SERV_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("SERVER_NAME"); - -CREATE INDEX "SENTRY_PRIV_DB_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("DB_NAME"); - -CREATE INDEX "SENTRY_PRIV_TBL_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("TABLE_NAME"); - -CREATE INDEX "SENTRY_PRIV_COL_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("COLUMN_NAME"); - -CREATE INDEX "SENTRY_PRIV_URI_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("URI"); - -ALTER TABLE ONLY "SENTRY_ROLE" - ADD CONSTRAINT "SENTRY_ROLE_ROLE_NAME_UNIQUE" UNIQUE ("ROLE_NAME"); - -ALTER TABLE ONLY "SENTRY_GROUP" - ADD CONSTRAINT "SENTRY_GRP_GRP_NAME_UNIQUE" UNIQUE ("GROUP_NAME"); - -ALTER TABLE "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SENTRY_ROLE_DB_PRIVILEGE_MAP_PK" PRIMARY KEY ("ROLE_ID","DB_PRIVILEGE_ID"); - -ALTER TABLE "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SENTRY_ROLE_GROUP_MAP_PK" PRIMARY KEY ("ROLE_ID","GROUP_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RLE_DB_PRV_MAP_SN_RLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RL_DB_PRV_MAP_SN_DB_PRV_FK" - FOREIGN KEY ("DB_PRIVILEGE_ID") REFERENCES "SENTRY_DB_PRIVILEGE"("DB_PRIVILEGE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SEN_ROLE_GROUP_MAP_SEN_ROLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SEN_ROLE_GROUP_MAP_SEN_GRP_FK" - FOREIGN KEY ("GROUP_ID") REFERENCES "SENTRY_GROUP"("GROUP_ID") DEFERRABLE; - -INSERT INTO "SENTRY_VERSION" ("VER_ID", "SCHEMA_VERSION", "VERSION_COMMENT") VALUES (1, '1.5.0', 'Sentry release version 1.5.0'); - --- Generic Model --- Table SENTRY_GM_PRIVILEGE for classes [org.apache.sentry.provider.db.service.model.MSentryGMPrivilege] -CREATE TABLE "SENTRY_GM_PRIVILEGE" ( - "GM_PRIVILEGE_ID" BIGINT NOT NULL, - "COMPONENT_NAME" character varying(32) NOT NULL, - "SERVICE_NAME" character varying(64) NOT NULL, - "RESOURCE_NAME_0" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_1" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_2" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_3" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_0" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_1" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_2" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_3" character varying(64) DEFAULT '__NULL__', - "ACTION" character varying(32) NOT NULL, - "SCOPE" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "WITH_GRANT_OPTION" CHAR(1) NOT NULL -); -ALTER TABLE ONLY "SENTRY_GM_PRIVILEGE" - ADD CONSTRAINT "SENTRY_GM_PRIV_PK" PRIMARY KEY ("GM_PRIVILEGE_ID"); --- Constraints for table SENTRY_GM_PRIVILEGE for class(es) [org.apache.sentry.provider.db.service.model.MSentryGMPrivilege] -ALTER TABLE ONLY "SENTRY_GM_PRIVILEGE" - ADD CONSTRAINT "SENTRY_GM_PRIV_PRIV_NAME_UNIQ" UNIQUE ("COMPONENT_NAME","SERVICE_NAME","RESOURCE_NAME_0","RESOURCE_NAME_1","RESOURCE_NAME_2", - "RESOURCE_NAME_3","RESOURCE_TYPE_0","RESOURCE_TYPE_1","RESOURCE_TYPE_2","RESOURCE_TYPE_3","ACTION","WITH_GRANT_OPTION"); - -CREATE INDEX "SENTRY_GM_PRIV_COMP_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("COMPONENT_NAME"); - -CREATE INDEX "SENTRY_GM_PRIV_SERV_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("SERVICE_NAME"); - -CREATE INDEX "SENTRY_GM_PRIV_RES0_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_0","RESOURCE_TYPE_0"); - -CREATE INDEX "SENTRY_GM_PRIV_RES1_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_1","RESOURCE_TYPE_1"); - -CREATE INDEX "SENTRY_GM_PRIV_RES2_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_2","RESOURCE_TYPE_2"); - -CREATE INDEX "SENTRY_GM_PRIV_RES3_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_3","RESOURCE_TYPE_3"); - --- Table SENTRY_ROLE_GM_PRIVILEGE_MAP for join relationship -CREATE TABLE "SENTRY_ROLE_GM_PRIVILEGE_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "GM_PRIVILEGE_ID" BIGINT NOT NULL -); - -ALTER TABLE "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SENTRY_ROLE_GM_PRIVILEGE_MAP_PK" PRIMARY KEY ("ROLE_ID","GM_PRIVILEGE_ID"); - --- Constraints for table SENTRY_ROLE_GM_PRIVILEGE_MAP -ALTER TABLE ONLY "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RLE_GM_PRV_MAP_SN_RLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RL_GM_PRV_MAP_SN_DB_PRV_FK" - FOREIGN KEY ("GM_PRIVILEGE_ID") REFERENCES "SENTRY_GM_PRIVILEGE"("GM_PRIVILEGE_ID") DEFERRABLE; - -COMMIT; http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.6.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.6.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.6.0.sql deleted file mode 100644 index 62edf3e..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.6.0.sql +++ /dev/null @@ -1,182 +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. - -START TRANSACTION; - -SET statement_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = off; -SET check_function_bodies = false; -SET client_min_messages = warning; -SET escape_string_warning = off; -SET search_path = public, pg_catalog; -SET default_tablespace = ''; -SET default_with_oids = false; - -CREATE TABLE "SENTRY_DB_PRIVILEGE" ( - "DB_PRIVILEGE_ID" BIGINT NOT NULL, - "PRIVILEGE_SCOPE" character varying(32) NOT NULL, - "SERVER_NAME" character varying(128) NOT NULL, - "DB_NAME" character varying(128) DEFAULT '__NULL__', - "TABLE_NAME" character varying(128) DEFAULT '__NULL__', - "COLUMN_NAME" character varying(128) DEFAULT '__NULL__', - "URI" character varying(4000) DEFAULT '__NULL__', - "ACTION" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "WITH_GRANT_OPTION" CHAR(1) NOT NULL -); - -CREATE TABLE "SENTRY_ROLE" ( - "ROLE_ID" BIGINT NOT NULL, - "ROLE_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL -); - -CREATE TABLE "SENTRY_GROUP" ( - "GROUP_ID" BIGINT NOT NULL, - "GROUP_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL -); - -CREATE TABLE "SENTRY_ROLE_DB_PRIVILEGE_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "DB_PRIVILEGE_ID" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) -); - -CREATE TABLE "SENTRY_ROLE_GROUP_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "GROUP_ID" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) -); - -CREATE TABLE "SENTRY_VERSION" ( - "VER_ID" bigint, - "SCHEMA_VERSION" character varying(127) NOT NULL, - "VERSION_COMMENT" character varying(255) NOT NULL -); - - -ALTER TABLE ONLY "SENTRY_DB_PRIVILEGE" - ADD CONSTRAINT "SENTRY_DB_PRIV_PK" PRIMARY KEY ("DB_PRIVILEGE_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE" - ADD CONSTRAINT "SENTRY_ROLE_PK" PRIMARY KEY ("ROLE_ID"); - -ALTER TABLE ONLY "SENTRY_GROUP" - ADD CONSTRAINT "SENTRY_GROUP_PK" PRIMARY KEY ("GROUP_ID"); - -ALTER TABLE ONLY "SENTRY_VERSION" ADD CONSTRAINT "SENTRY_VERSION_PK" PRIMARY KEY ("VER_ID"); - -ALTER TABLE ONLY "SENTRY_DB_PRIVILEGE" - ADD CONSTRAINT "SENTRY_DB_PRIV_PRIV_NAME_UNIQ" UNIQUE ("SERVER_NAME","DB_NAME","TABLE_NAME","COLUMN_NAME","URI", "ACTION","WITH_GRANT_OPTION"); - -CREATE INDEX "SENTRY_PRIV_SERV_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("SERVER_NAME"); - -CREATE INDEX "SENTRY_PRIV_DB_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("DB_NAME"); - -CREATE INDEX "SENTRY_PRIV_TBL_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("TABLE_NAME"); - -CREATE INDEX "SENTRY_PRIV_COL_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("COLUMN_NAME"); - -CREATE INDEX "SENTRY_PRIV_URI_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("URI"); - -ALTER TABLE ONLY "SENTRY_ROLE" - ADD CONSTRAINT "SENTRY_ROLE_ROLE_NAME_UNIQUE" UNIQUE ("ROLE_NAME"); - -ALTER TABLE ONLY "SENTRY_GROUP" - ADD CONSTRAINT "SENTRY_GRP_GRP_NAME_UNIQUE" UNIQUE ("GROUP_NAME"); - -ALTER TABLE "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SENTRY_ROLE_DB_PRIVILEGE_MAP_PK" PRIMARY KEY ("ROLE_ID","DB_PRIVILEGE_ID"); - -ALTER TABLE "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SENTRY_ROLE_GROUP_MAP_PK" PRIMARY KEY ("ROLE_ID","GROUP_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RLE_DB_PRV_MAP_SN_RLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RL_DB_PRV_MAP_SN_DB_PRV_FK" - FOREIGN KEY ("DB_PRIVILEGE_ID") REFERENCES "SENTRY_DB_PRIVILEGE"("DB_PRIVILEGE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SEN_ROLE_GROUP_MAP_SEN_ROLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SEN_ROLE_GROUP_MAP_SEN_GRP_FK" - FOREIGN KEY ("GROUP_ID") REFERENCES "SENTRY_GROUP"("GROUP_ID") DEFERRABLE; - -INSERT INTO "SENTRY_VERSION" ("VER_ID", "SCHEMA_VERSION", "VERSION_COMMENT") VALUES (1, '1.6.0', 'Sentry release version 1.6.0'); - --- Generic Model --- Table SENTRY_GM_PRIVILEGE for classes [org.apache.sentry.provider.db.service.model.MSentryGMPrivilege] -CREATE TABLE "SENTRY_GM_PRIVILEGE" ( - "GM_PRIVILEGE_ID" BIGINT NOT NULL, - "COMPONENT_NAME" character varying(32) NOT NULL, - "SERVICE_NAME" character varying(64) NOT NULL, - "RESOURCE_NAME_0" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_1" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_2" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_3" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_0" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_1" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_2" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_3" character varying(64) DEFAULT '__NULL__', - "ACTION" character varying(32) NOT NULL, - "SCOPE" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "WITH_GRANT_OPTION" CHAR(1) NOT NULL -); -ALTER TABLE ONLY "SENTRY_GM_PRIVILEGE" - ADD CONSTRAINT "SENTRY_GM_PRIV_PK" PRIMARY KEY ("GM_PRIVILEGE_ID"); --- Constraints for table SENTRY_GM_PRIVILEGE for class(es) [org.apache.sentry.provider.db.service.model.MSentryGMPrivilege] -ALTER TABLE ONLY "SENTRY_GM_PRIVILEGE" - ADD CONSTRAINT "SENTRY_GM_PRIV_PRIV_NAME_UNIQ" UNIQUE ("COMPONENT_NAME","SERVICE_NAME","RESOURCE_NAME_0","RESOURCE_NAME_1","RESOURCE_NAME_2", - "RESOURCE_NAME_3","RESOURCE_TYPE_0","RESOURCE_TYPE_1","RESOURCE_TYPE_2","RESOURCE_TYPE_3","ACTION","WITH_GRANT_OPTION"); - -CREATE INDEX "SENTRY_GM_PRIV_COMP_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("COMPONENT_NAME"); - -CREATE INDEX "SENTRY_GM_PRIV_SERV_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("SERVICE_NAME"); - -CREATE INDEX "SENTRY_GM_PRIV_RES0_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_0","RESOURCE_TYPE_0"); - -CREATE INDEX "SENTRY_GM_PRIV_RES1_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_1","RESOURCE_TYPE_1"); - -CREATE INDEX "SENTRY_GM_PRIV_RES2_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_2","RESOURCE_TYPE_2"); - -CREATE INDEX "SENTRY_GM_PRIV_RES3_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_3","RESOURCE_TYPE_3"); - --- Table SENTRY_ROLE_GM_PRIVILEGE_MAP for join relationship -CREATE TABLE "SENTRY_ROLE_GM_PRIVILEGE_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "GM_PRIVILEGE_ID" BIGINT NOT NULL -); - -ALTER TABLE "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SENTRY_ROLE_GM_PRIVILEGE_MAP_PK" PRIMARY KEY ("ROLE_ID","GM_PRIVILEGE_ID"); - --- Constraints for table SENTRY_ROLE_GM_PRIVILEGE_MAP -ALTER TABLE ONLY "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RLE_GM_PRV_MAP_SN_RLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RL_GM_PRV_MAP_SN_DB_PRV_FK" - FOREIGN KEY ("GM_PRIVILEGE_ID") REFERENCES "SENTRY_GM_PRIVILEGE"("GM_PRIVILEGE_ID") DEFERRABLE; - -COMMIT; http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.7.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.7.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.7.0.sql deleted file mode 100644 index 9f4f85b..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.7.0.sql +++ /dev/null @@ -1,182 +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. - -START TRANSACTION; - -SET statement_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = off; -SET check_function_bodies = false; -SET client_min_messages = warning; -SET escape_string_warning = off; -SET search_path = public, pg_catalog; -SET default_tablespace = ''; -SET default_with_oids = false; - -CREATE TABLE "SENTRY_DB_PRIVILEGE" ( - "DB_PRIVILEGE_ID" BIGINT NOT NULL, - "PRIVILEGE_SCOPE" character varying(32) NOT NULL, - "SERVER_NAME" character varying(128) NOT NULL, - "DB_NAME" character varying(128) DEFAULT '__NULL__', - "TABLE_NAME" character varying(128) DEFAULT '__NULL__', - "COLUMN_NAME" character varying(128) DEFAULT '__NULL__', - "URI" character varying(4000) DEFAULT '__NULL__', - "ACTION" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "WITH_GRANT_OPTION" CHAR(1) NOT NULL -); - -CREATE TABLE "SENTRY_ROLE" ( - "ROLE_ID" BIGINT NOT NULL, - "ROLE_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL -); - -CREATE TABLE "SENTRY_GROUP" ( - "GROUP_ID" BIGINT NOT NULL, - "GROUP_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL -); - -CREATE TABLE "SENTRY_ROLE_DB_PRIVILEGE_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "DB_PRIVILEGE_ID" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) -); - -CREATE TABLE "SENTRY_ROLE_GROUP_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "GROUP_ID" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) -); - -CREATE TABLE "SENTRY_VERSION" ( - "VER_ID" bigint, - "SCHEMA_VERSION" character varying(127) NOT NULL, - "VERSION_COMMENT" character varying(255) NOT NULL -); - - -ALTER TABLE ONLY "SENTRY_DB_PRIVILEGE" - ADD CONSTRAINT "SENTRY_DB_PRIV_PK" PRIMARY KEY ("DB_PRIVILEGE_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE" - ADD CONSTRAINT "SENTRY_ROLE_PK" PRIMARY KEY ("ROLE_ID"); - -ALTER TABLE ONLY "SENTRY_GROUP" - ADD CONSTRAINT "SENTRY_GROUP_PK" PRIMARY KEY ("GROUP_ID"); - -ALTER TABLE ONLY "SENTRY_VERSION" ADD CONSTRAINT "SENTRY_VERSION_PK" PRIMARY KEY ("VER_ID"); - -ALTER TABLE ONLY "SENTRY_DB_PRIVILEGE" - ADD CONSTRAINT "SENTRY_DB_PRIV_PRIV_NAME_UNIQ" UNIQUE ("SERVER_NAME","DB_NAME","TABLE_NAME","COLUMN_NAME","URI", "ACTION","WITH_GRANT_OPTION"); - -CREATE INDEX "SENTRY_PRIV_SERV_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("SERVER_NAME"); - -CREATE INDEX "SENTRY_PRIV_DB_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("DB_NAME"); - -CREATE INDEX "SENTRY_PRIV_TBL_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("TABLE_NAME"); - -CREATE INDEX "SENTRY_PRIV_COL_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("COLUMN_NAME"); - -CREATE INDEX "SENTRY_PRIV_URI_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("URI"); - -ALTER TABLE ONLY "SENTRY_ROLE" - ADD CONSTRAINT "SENTRY_ROLE_ROLE_NAME_UNIQUE" UNIQUE ("ROLE_NAME"); - -ALTER TABLE ONLY "SENTRY_GROUP" - ADD CONSTRAINT "SENTRY_GRP_GRP_NAME_UNIQUE" UNIQUE ("GROUP_NAME"); - -ALTER TABLE "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SENTRY_ROLE_DB_PRIVILEGE_MAP_PK" PRIMARY KEY ("ROLE_ID","DB_PRIVILEGE_ID"); - -ALTER TABLE "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SENTRY_ROLE_GROUP_MAP_PK" PRIMARY KEY ("ROLE_ID","GROUP_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RLE_DB_PRV_MAP_SN_RLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RL_DB_PRV_MAP_SN_DB_PRV_FK" - FOREIGN KEY ("DB_PRIVILEGE_ID") REFERENCES "SENTRY_DB_PRIVILEGE"("DB_PRIVILEGE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SEN_ROLE_GROUP_MAP_SEN_ROLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SEN_ROLE_GROUP_MAP_SEN_GRP_FK" - FOREIGN KEY ("GROUP_ID") REFERENCES "SENTRY_GROUP"("GROUP_ID") DEFERRABLE; - -INSERT INTO "SENTRY_VERSION" ("VER_ID", "SCHEMA_VERSION", "VERSION_COMMENT") VALUES (1, '1.7.0', 'Sentry release version 1.7.0'); - --- Generic Model --- Table SENTRY_GM_PRIVILEGE for classes [org.apache.sentry.provider.db.service.model.MSentryGMPrivilege] -CREATE TABLE "SENTRY_GM_PRIVILEGE" ( - "GM_PRIVILEGE_ID" BIGINT NOT NULL, - "COMPONENT_NAME" character varying(32) NOT NULL, - "SERVICE_NAME" character varying(64) NOT NULL, - "RESOURCE_NAME_0" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_1" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_2" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_3" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_0" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_1" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_2" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_3" character varying(64) DEFAULT '__NULL__', - "ACTION" character varying(32) NOT NULL, - "SCOPE" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "WITH_GRANT_OPTION" CHAR(1) NOT NULL -); -ALTER TABLE ONLY "SENTRY_GM_PRIVILEGE" - ADD CONSTRAINT "SENTRY_GM_PRIV_PK" PRIMARY KEY ("GM_PRIVILEGE_ID"); --- Constraints for table SENTRY_GM_PRIVILEGE for class(es) [org.apache.sentry.provider.db.service.model.MSentryGMPrivilege] -ALTER TABLE ONLY "SENTRY_GM_PRIVILEGE" - ADD CONSTRAINT "SENTRY_GM_PRIV_PRIV_NAME_UNIQ" UNIQUE ("COMPONENT_NAME","SERVICE_NAME","RESOURCE_NAME_0","RESOURCE_NAME_1","RESOURCE_NAME_2", - "RESOURCE_NAME_3","RESOURCE_TYPE_0","RESOURCE_TYPE_1","RESOURCE_TYPE_2","RESOURCE_TYPE_3","ACTION","WITH_GRANT_OPTION"); - -CREATE INDEX "SENTRY_GM_PRIV_COMP_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("COMPONENT_NAME"); - -CREATE INDEX "SENTRY_GM_PRIV_SERV_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("SERVICE_NAME"); - -CREATE INDEX "SENTRY_GM_PRIV_RES0_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_0","RESOURCE_TYPE_0"); - -CREATE INDEX "SENTRY_GM_PRIV_RES1_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_1","RESOURCE_TYPE_1"); - -CREATE INDEX "SENTRY_GM_PRIV_RES2_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_2","RESOURCE_TYPE_2"); - -CREATE INDEX "SENTRY_GM_PRIV_RES3_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_3","RESOURCE_TYPE_3"); - --- Table SENTRY_ROLE_GM_PRIVILEGE_MAP for join relationship -CREATE TABLE "SENTRY_ROLE_GM_PRIVILEGE_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "GM_PRIVILEGE_ID" BIGINT NOT NULL -); - -ALTER TABLE "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SENTRY_ROLE_GM_PRIVILEGE_MAP_PK" PRIMARY KEY ("ROLE_ID","GM_PRIVILEGE_ID"); - --- Constraints for table SENTRY_ROLE_GM_PRIVILEGE_MAP -ALTER TABLE ONLY "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RLE_GM_PRV_MAP_SN_RLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RL_GM_PRV_MAP_SN_DB_PRV_FK" - FOREIGN KEY ("GM_PRIVILEGE_ID") REFERENCES "SENTRY_GM_PRIVILEGE"("GM_PRIVILEGE_ID") DEFERRABLE; - -COMMIT; http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.8.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.8.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.8.0.sql deleted file mode 100644 index 6d56332..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-postgres-1.8.0.sql +++ /dev/null @@ -1,211 +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. - -START TRANSACTION; - -SET statement_timeout = 0; -SET client_encoding = 'UTF8'; -SET standard_conforming_strings = off; -SET check_function_bodies = false; -SET client_min_messages = warning; -SET escape_string_warning = off; -SET search_path = public, pg_catalog; -SET default_tablespace = ''; -SET default_with_oids = false; - -CREATE TABLE "SENTRY_DB_PRIVILEGE" ( - "DB_PRIVILEGE_ID" BIGINT NOT NULL, - "PRIVILEGE_SCOPE" character varying(32) NOT NULL, - "SERVER_NAME" character varying(128) NOT NULL, - "DB_NAME" character varying(128) DEFAULT '__NULL__', - "TABLE_NAME" character varying(128) DEFAULT '__NULL__', - "COLUMN_NAME" character varying(128) DEFAULT '__NULL__', - "URI" character varying(4000) DEFAULT '__NULL__', - "ACTION" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "WITH_GRANT_OPTION" CHAR(1) NOT NULL -); - -CREATE TABLE "SENTRY_ROLE" ( - "ROLE_ID" BIGINT NOT NULL, - "ROLE_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL -); - -CREATE TABLE "SENTRY_GROUP" ( - "GROUP_ID" BIGINT NOT NULL, - "GROUP_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL -); - -CREATE TABLE "SENTRY_ROLE_DB_PRIVILEGE_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "DB_PRIVILEGE_ID" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) -); - -CREATE TABLE "SENTRY_ROLE_GROUP_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "GROUP_ID" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) -); - -CREATE TABLE "SENTRY_VERSION" ( - "VER_ID" bigint, - "SCHEMA_VERSION" character varying(127) NOT NULL, - "VERSION_COMMENT" character varying(255) NOT NULL -); - - -ALTER TABLE ONLY "SENTRY_DB_PRIVILEGE" - ADD CONSTRAINT "SENTRY_DB_PRIV_PK" PRIMARY KEY ("DB_PRIVILEGE_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE" - ADD CONSTRAINT "SENTRY_ROLE_PK" PRIMARY KEY ("ROLE_ID"); - -ALTER TABLE ONLY "SENTRY_GROUP" - ADD CONSTRAINT "SENTRY_GROUP_PK" PRIMARY KEY ("GROUP_ID"); - -ALTER TABLE ONLY "SENTRY_VERSION" ADD CONSTRAINT "SENTRY_VERSION_PK" PRIMARY KEY ("VER_ID"); - -ALTER TABLE ONLY "SENTRY_DB_PRIVILEGE" - ADD CONSTRAINT "SENTRY_DB_PRIV_PRIV_NAME_UNIQ" UNIQUE ("SERVER_NAME","DB_NAME","TABLE_NAME","COLUMN_NAME","URI", "ACTION","WITH_GRANT_OPTION"); - -CREATE INDEX "SENTRY_PRIV_SERV_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("SERVER_NAME"); - -CREATE INDEX "SENTRY_PRIV_DB_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("DB_NAME"); - -CREATE INDEX "SENTRY_PRIV_TBL_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("TABLE_NAME"); - -CREATE INDEX "SENTRY_PRIV_COL_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("COLUMN_NAME"); - -CREATE INDEX "SENTRY_PRIV_URI_IDX" ON "SENTRY_DB_PRIVILEGE" USING btree ("URI"); - -ALTER TABLE ONLY "SENTRY_ROLE" - ADD CONSTRAINT "SENTRY_ROLE_ROLE_NAME_UNIQUE" UNIQUE ("ROLE_NAME"); - -ALTER TABLE ONLY "SENTRY_GROUP" - ADD CONSTRAINT "SENTRY_GRP_GRP_NAME_UNIQUE" UNIQUE ("GROUP_NAME"); - -ALTER TABLE "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SENTRY_ROLE_DB_PRIVILEGE_MAP_PK" PRIMARY KEY ("ROLE_ID","DB_PRIVILEGE_ID"); - -ALTER TABLE "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SENTRY_ROLE_GROUP_MAP_PK" PRIMARY KEY ("ROLE_ID","GROUP_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RLE_DB_PRV_MAP_SN_RLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_DB_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RL_DB_PRV_MAP_SN_DB_PRV_FK" - FOREIGN KEY ("DB_PRIVILEGE_ID") REFERENCES "SENTRY_DB_PRIVILEGE"("DB_PRIVILEGE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SEN_ROLE_GROUP_MAP_SEN_ROLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GROUP_MAP" - ADD CONSTRAINT "SEN_ROLE_GROUP_MAP_SEN_GRP_FK" - FOREIGN KEY ("GROUP_ID") REFERENCES "SENTRY_GROUP"("GROUP_ID") DEFERRABLE; - -INSERT INTO "SENTRY_VERSION" ("VER_ID", "SCHEMA_VERSION", "VERSION_COMMENT") VALUES (1, '1.8.0', 'Sentry release version 1.8.0'); - --- Generic Model --- Table SENTRY_GM_PRIVILEGE for classes [org.apache.sentry.provider.db.service.model.MSentryGMPrivilege] -CREATE TABLE "SENTRY_GM_PRIVILEGE" ( - "GM_PRIVILEGE_ID" BIGINT NOT NULL, - "COMPONENT_NAME" character varying(32) NOT NULL, - "SERVICE_NAME" character varying(64) NOT NULL, - "RESOURCE_NAME_0" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_1" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_2" character varying(64) DEFAULT '__NULL__', - "RESOURCE_NAME_3" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_0" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_1" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_2" character varying(64) DEFAULT '__NULL__', - "RESOURCE_TYPE_3" character varying(64) DEFAULT '__NULL__', - "ACTION" character varying(32) NOT NULL, - "SCOPE" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL, - "WITH_GRANT_OPTION" CHAR(1) NOT NULL -); -ALTER TABLE ONLY "SENTRY_GM_PRIVILEGE" - ADD CONSTRAINT "SENTRY_GM_PRIV_PK" PRIMARY KEY ("GM_PRIVILEGE_ID"); --- Constraints for table SENTRY_GM_PRIVILEGE for class(es) [org.apache.sentry.provider.db.service.model.MSentryGMPrivilege] -ALTER TABLE ONLY "SENTRY_GM_PRIVILEGE" - ADD CONSTRAINT "SENTRY_GM_PRIV_PRIV_NAME_UNIQ" UNIQUE ("COMPONENT_NAME","SERVICE_NAME","RESOURCE_NAME_0","RESOURCE_NAME_1","RESOURCE_NAME_2", - "RESOURCE_NAME_3","RESOURCE_TYPE_0","RESOURCE_TYPE_1","RESOURCE_TYPE_2","RESOURCE_TYPE_3","ACTION","WITH_GRANT_OPTION"); - -CREATE INDEX "SENTRY_GM_PRIV_COMP_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("COMPONENT_NAME"); - -CREATE INDEX "SENTRY_GM_PRIV_SERV_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("SERVICE_NAME"); - -CREATE INDEX "SENTRY_GM_PRIV_RES0_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_0","RESOURCE_TYPE_0"); - -CREATE INDEX "SENTRY_GM_PRIV_RES1_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_1","RESOURCE_TYPE_1"); - -CREATE INDEX "SENTRY_GM_PRIV_RES2_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_2","RESOURCE_TYPE_2"); - -CREATE INDEX "SENTRY_GM_PRIV_RES3_IDX" ON "SENTRY_GM_PRIVILEGE" USING btree ("RESOURCE_NAME_3","RESOURCE_TYPE_3"); - --- Table SENTRY_ROLE_GM_PRIVILEGE_MAP for join relationship -CREATE TABLE "SENTRY_ROLE_GM_PRIVILEGE_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "GM_PRIVILEGE_ID" BIGINT NOT NULL -); - -ALTER TABLE "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SENTRY_ROLE_GM_PRIVILEGE_MAP_PK" PRIMARY KEY ("ROLE_ID","GM_PRIVILEGE_ID"); - --- Constraints for table SENTRY_ROLE_GM_PRIVILEGE_MAP -ALTER TABLE ONLY "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RLE_GM_PRV_MAP_SN_RLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_GM_PRIVILEGE_MAP" - ADD CONSTRAINT "SEN_RL_GM_PRV_MAP_SN_DB_PRV_FK" - FOREIGN KEY ("GM_PRIVILEGE_ID") REFERENCES "SENTRY_GM_PRIVILEGE"("GM_PRIVILEGE_ID") DEFERRABLE; - -CREATE TABLE "SENTRY_USER" ( - "USER_ID" BIGINT NOT NULL, - "USER_NAME" character varying(128) NOT NULL, - "CREATE_TIME" BIGINT NOT NULL -); - -ALTER TABLE ONLY "SENTRY_USER" - ADD CONSTRAINT "SENTRY_USER_PK" PRIMARY KEY ("USER_ID"); - -ALTER TABLE ONLY "SENTRY_USER" - ADD CONSTRAINT "SENTRY_USER_USER_NAME_UNIQUE" UNIQUE ("USER_NAME"); - -CREATE TABLE "SENTRY_ROLE_USER_MAP" ( - "ROLE_ID" BIGINT NOT NULL, - "USER_ID" BIGINT NOT NULL, - "GRANTOR_PRINCIPAL" character varying(128) -); - -ALTER TABLE "SENTRY_ROLE_USER_MAP" - ADD CONSTRAINT "SENTRY_ROLE_USER_MAP_PK" PRIMARY KEY ("ROLE_ID","USER_ID"); - -ALTER TABLE ONLY "SENTRY_ROLE_USER_MAP" - ADD CONSTRAINT "SEN_ROLE_USER_MAP_SEN_ROLE_FK" - FOREIGN KEY ("ROLE_ID") REFERENCES "SENTRY_ROLE"("ROLE_ID") DEFERRABLE; - -ALTER TABLE ONLY "SENTRY_ROLE_USER_MAP" - ADD CONSTRAINT "SEN_ROLE_USER_MAP_SEN_USER_FK" - FOREIGN KEY ("USER_ID") REFERENCES "SENTRY_USER"("USER_ID") DEFERRABLE; - -COMMIT; http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.4.0-to-1.5.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.4.0-to-1.5.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.4.0-to-1.5.0.sql deleted file mode 100644 index 26721c9..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.4.0-to-1.5.0.sql +++ /dev/null @@ -1,61 +0,0 @@ --- SENTRY-327 -ALTER TABLE SENTRY_DB_PRIVILEGE ADD WITH_GRANT_OPTION CHAR(1) NOT NULL; - --- SENTRY-339 -DROP INDEX SENTRYPRIVILEGENAME; -CREATE UNIQUE INDEX SENTRYPRIVILEGENAME ON SENTRY_DB_PRIVILEGE ("SERVER_NAME",DB_NAME,"TABLE_NAME",URI,"ACTION",WITH_GRANT_OPTION); -ALTER TABLE SENTRY_DB_PRIVILEGE DROP PRIVILEGE_NAME; - --- SENTRY-380 -ALTER TABLE `SENTRY_DB_PRIVILEGE` DROP `GRANTOR_PRINCIPAL`; -ALTER TABLE `SENTRY_ROLE` DROP `GRANTOR_PRINCIPAL`; -ALTER TABLE `SENTRY_GROUP` DROP `GRANTOR_PRINCIPAL`; - -ALTER TABLE `SENTRY_ROLE_DB_PRIVILEGE_MAP` ADD `GRANTOR_PRINCIPAL` VARCHAR(128); -ALTER TABLE `SENTRY_ROLE_GROUP_MAP` ADD `GRANTOR_PRINCIPAL` VARCHAR(128); - --- SENTRY-74 -ALTER TABLE `SENTRY_DB_PRIVILEGE` ADD `COLUMN_NAME` CHAR(4000); -DROP INDEX SENTRYPRIVILEGENAME; -CREATE UNIQUE INDEX SENTRYPRIVILEGENAME ON SENTRY_DB_PRIVILEGE ("SERVER_NAME",DB_NAME,"TABLE_NAME","COLUMN_NAME",URI,"ACTION",WITH_GRANT_OPTION); - --- SENTRY-398 -CREATE TABLE SENTRY_GM_PRIVILEGE -( - GM_PRIVILEGE_ID BIGINT NOT NULL, - "ACTION" VARCHAR(40), - COMPONENT_NAME VARCHAR(400), - CREATE_TIME BIGINT NOT NULL, - WITH_GRANT_OPTION CHAR(1), - RESOURCE_NAME_0 VARCHAR(400), - RESOURCE_NAME_1 VARCHAR(400), - RESOURCE_NAME_2 VARCHAR(400), - RESOURCE_NAME_3 VARCHAR(400), - RESOURCE_TYPE_0 VARCHAR(400), - RESOURCE_TYPE_1 VARCHAR(400), - RESOURCE_TYPE_2 VARCHAR(400), - RESOURCE_TYPE_3 VARCHAR(400), - "SCOPE" VARCHAR(40), - SERVICE_NAME VARCHAR(400) -); -ALTER TABLE SENTRY_GM_PRIVILEGE ADD CONSTRAINT SENTRY_GM_PRIVILEGE_PK PRIMARY KEY (GM_PRIVILEGE_ID); - -CREATE UNIQUE INDEX GM_PRIVILEGE_INDEX ON SENTRY_GM_PRIVILEGE (COMPONENT_NAME,SERVICE_NAME,RESOURCE_NAME_0,RESOURCE_TYPE_0,RESOURCE_NAME_1,RESOURCE_TYPE_1,RESOURCE_NAME_2,RESOURCE_TYPE_2,RESOURCE_NAME_3,RESOURCE_TYPE_3,"ACTION",WITH_GRANT_OPTION); - -CREATE TABLE SENTRY_ROLE_GM_PRIVILEGE_MAP -( - ROLE_ID BIGINT NOT NULL, - GM_PRIVILEGE_ID BIGINT NOT NULL -); -ALTER TABLE SENTRY_ROLE_GM_PRIVILEGE_MAP ADD CONSTRAINT SENTRY_ROLE_GM_PRIVILEGE_MAP_PK PRIMARY KEY (ROLE_ID,GM_PRIVILEGE_ID); - -CREATE INDEX SENTRY_ROLE_GM_PRIVILEGE_MAP_N50 ON SENTRY_ROLE_GM_PRIVILEGE_MAP (ROLE_ID); - -CREATE INDEX SENTRY_ROLE_GM_PRIVILEGE_MAP_N49 ON SENTRY_ROLE_GM_PRIVILEGE_MAP (GM_PRIVILEGE_ID); - -ALTER TABLE SENTRY_ROLE_GM_PRIVILEGE_MAP ADD CONSTRAINT SENTRY_ROLE_GM_PRIVILEGE_MAP_FK2 FOREIGN KEY (GM_PRIVILEGE_ID) REFERENCES SENTRY_GM_PRIVILEGE (GM_PRIVILEGE_ID); - -ALTER TABLE SENTRY_ROLE_GM_PRIVILEGE_MAP ADD CONSTRAINT SENTRY_ROLE_GM_PRIVILEGE_MAP_FK1 FOREIGN KEY (ROLE_ID) REFERENCES SENTRY_ROLE (ROLE_ID); - --- Version update -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.5.0', VERSION_COMMENT='Sentry release version 1.5.0' WHERE VER_ID=1; http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.5.0-to-1.6.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.5.0-to-1.6.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.5.0-to-1.6.0.sql deleted file mode 100644 index 5560d9f..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.5.0-to-1.6.0.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Version update -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.6.0', VERSION_COMMENT='Sentry release version 1.6.0' WHERE VER_ID=1; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.6.0-to-1.7.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.6.0-to-1.7.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.6.0-to-1.7.0.sql deleted file mode 100644 index e2494a2..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.6.0-to-1.7.0.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Version update -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.7.0', VERSION_COMMENT='Sentry release version 1.7.0' WHERE VER_ID=1; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.7.0-to-1.8.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.7.0-to-1.8.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.7.0-to-1.8.0.sql deleted file mode 100644 index 927f302..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-db2-1.7.0-to-1.8.0.sql +++ /dev/null @@ -1,31 +0,0 @@ --- SENTRY-711 -CREATE TABLE SENTRY_USER -( - USER_ID BIGINT NOT NULL generated always as identity (start with 1), - CREATE_TIME BIGINT NOT NULL, - USER_NAME VARCHAR(128) -); - -ALTER TABLE SENTRY_USER ADD CONSTRAINT SENTRY_USER_PK PRIMARY KEY (USER_ID); - -CREATE UNIQUE INDEX SENTRYUSERNAME ON SENTRY_USER (USER_NAME); - -CREATE TABLE SENTRY_ROLE_USER_MAP -( - USER_ID BIGINT NOT NULL, - ROLE_ID BIGINT NOT NULL, - GRANTOR_PRINCIPAL VARCHAR(128) -); - -ALTER TABLE SENTRY_ROLE_USER_MAP ADD CONSTRAINT SENTRY_ROLE_USER_MAP_PK PRIMARY KEY (USER_ID,ROLE_ID); - -CREATE INDEX SENTRY_ROLE_USER_MAP_N49 ON SENTRY_ROLE_USER_MAP (USER_ID); - -CREATE INDEX SENTRY_ROLE_USER_MAP_N50 ON SENTRY_ROLE_USER_MAP (ROLE_ID); - -ALTER TABLE SENTRY_ROLE_USER_MAP ADD CONSTRAINT SENTRY_ROLE_USER_MAP_FK2 FOREIGN KEY (ROLE_ID) REFERENCES SENTRY_ROLE (ROLE_ID) ; - -ALTER TABLE SENTRY_ROLE_USER_MAP ADD CONSTRAINT SENTRY_ROLE_USER_MAP_FK1 FOREIGN KEY (USER_ID) REFERENCES SENTRY_USER (USER_ID) ; - --- Version update -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.8.0', VERSION_COMMENT='Sentry release version 1.8.0' WHERE VER_ID=1; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.4.0-to-1.5.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.4.0-to-1.5.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.4.0-to-1.5.0.sql deleted file mode 100644 index bc06849..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.4.0-to-1.5.0.sql +++ /dev/null @@ -1,8 +0,0 @@ -RUN '001-SENTRY-327.derby.sql'; -RUN '002-SENTRY-339.derby.sql'; -RUN '003-SENTRY-380.derby.sql'; -RUN '004-SENTRY-74.derby.sql'; -RUN '005-SENTRY-398.derby.sql'; - --- Version update -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.5.0', VERSION_COMMENT='Sentry release version 1.5.0' WHERE VER_ID=1; http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.5.0-to-1.6.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.5.0-to-1.6.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.5.0-to-1.6.0.sql deleted file mode 100644 index 5560d9f..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.5.0-to-1.6.0.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Version update -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.6.0', VERSION_COMMENT='Sentry release version 1.6.0' WHERE VER_ID=1; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.6.0-to-1.7.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.6.0-to-1.7.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.6.0-to-1.7.0.sql deleted file mode 100644 index e2494a2..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.6.0-to-1.7.0.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Version update -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.7.0', VERSION_COMMENT='Sentry release version 1.7.0' WHERE VER_ID=1; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.7.0-to-1.8.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.7.0-to-1.8.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.7.0-to-1.8.0.sql deleted file mode 100644 index fbe2dc8..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-derby-1.7.0-to-1.8.0.sql +++ /dev/null @@ -1,4 +0,0 @@ -RUN '006-SENTRY-711.derby.sql'; - --- Version update -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.8.0', VERSION_COMMENT='Sentry release version 1.8.0' WHERE VER_ID=1; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.4.0-to-1.5.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.4.0-to-1.5.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.4.0-to-1.5.0.sql deleted file mode 100644 index a7bc9d0..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.4.0-to-1.5.0.sql +++ /dev/null @@ -1,10 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.4.0 to 1.5.0' AS ' '; -SOURCE 001-SENTRY-327.mysql.sql; -SOURCE 002-SENTRY-339.mysql.sql; -SOURCE 003-SENTRY-380.mysql.sql; -SOURCE 004-SENTRY-74.mysql.sql; -SOURCE 005-SENTRY-398.mysql.sql; - -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.5.0', VERSION_COMMENT='Sentry release version 1.5.0' WHERE VER_ID=1; -SELECT 'Finish upgrading Sentry store schema from 1.4.0 to 1.5.0' AS ' '; - http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.5.0-to-1.6.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.5.0-to-1.6.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.5.0-to-1.6.0.sql deleted file mode 100644 index 352332c..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.5.0-to-1.6.0.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.5.0 to 1.6.0' AS ' '; - -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.6.0', VERSION_COMMENT='Sentry release version 1.6.0' WHERE VER_ID=1; - -SELECT 'Finish upgrading Sentry store schema from 1.5.0 to 1.6.0' AS ' '; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.6.0-to-1.7.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.6.0-to-1.7.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.6.0-to-1.7.0.sql deleted file mode 100644 index 3413ede..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.6.0-to-1.7.0.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.6.0 to 1.7.0' AS ' '; - -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.7.0', VERSION_COMMENT='Sentry release version 1.7.0' WHERE VER_ID=1; - -SELECT 'Finish upgrading Sentry store schema from 1.6.0 to 1.7.0' AS ' '; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.7.0-to-1.8.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.7.0-to-1.8.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.7.0-to-1.8.0.sql deleted file mode 100644 index f0df187..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-mysql-1.7.0-to-1.8.0.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.7.0 to 1.8.0' AS ' '; -SOURCE 006-SENTRY-711.mysql.sql; - -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.8.0', VERSION_COMMENT='Sentry release version 1.8.0' WHERE VER_ID=1; - -SELECT 'Finish upgrading Sentry store schema from 1.7.0 to 1.8.0' AS ' '; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.4.0-to-1.5.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.4.0-to-1.5.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.4.0-to-1.5.0.sql deleted file mode 100644 index 9526366..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.4.0-to-1.5.0.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.4.0 to 1.5.0' AS Status from dual; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; - -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.5.0', VERSION_COMMENT='Sentry release version 1.5.0' WHERE VER_ID=1; -SELECT 'Finished upgrading Sentry store schema from 1.4.0 to 1.5.0' AS Status from dual; http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.5.0-to-1.6.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.5.0-to-1.6.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.5.0-to-1.6.0.sql deleted file mode 100644 index 3437075..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.5.0-to-1.6.0.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.5.0 to 1.6.0' AS Status from dual; - -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.6.0', VERSION_COMMENT='Sentry release version 1.6.0' WHERE VER_ID=1; - -SELECT 'Finished upgrading Sentry store schema from 1.5.0 to 1.6.0' AS Status from dual; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.6.0-to-1.7.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.6.0-to-1.7.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.6.0-to-1.7.0.sql deleted file mode 100644 index fa82c87..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.6.0-to-1.7.0.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.6.0 to 1.7.0' AS Status from dual; - -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.7.0', VERSION_COMMENT='Sentry release version 1.7.0' WHERE VER_ID=1; - -SELECT 'Finished upgrading Sentry store schema from 1.6.0 to 1.7.0' AS Status from dual; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.7.0-to-1.8.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.7.0-to-1.8.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.7.0-to-1.8.0.sql deleted file mode 100644 index f1666be..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-oracle-1.7.0-to-1.8.0.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.7.0 to 1.8.0' AS Status from dual; [email protected]; - -UPDATE SENTRY_VERSION SET SCHEMA_VERSION='1.8.0', VERSION_COMMENT='Sentry release version 1.8.0' WHERE VER_ID=1; - -SELECT 'Finished upgrading Sentry store schema from 1.7.0 to 1.8.0' AS Status from dual; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.4.0-to-1.5.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.4.0-to-1.5.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.4.0-to-1.5.0.sql deleted file mode 100644 index 2f03d5e..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.4.0-to-1.5.0.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.4.0 to 1.5.0'; -\i 001-SENTRY-327.postgres.sql; -\i 002-SENTRY-339.postgres.sql; -\i 003-SENTRY-380.postgres.sql; -\i 004-SENTRY-74.postgres.sql; -\i 005-SENTRY-398.postgres.sql; - -UPDATE "SENTRY_VERSION" SET "SCHEMA_VERSION"='1.5.0', "VERSION_COMMENT"='Sentry release version 1.5.0' WHERE "VER_ID"=1; -SELECT 'Finished upgrading Sentry store schema from 1.4.0 to 1.5.0'; http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.5.0-to-1.6.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.5.0-to-1.6.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.5.0-to-1.6.0.sql deleted file mode 100644 index 5982596..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.5.0-to-1.6.0.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.5.0 to 1.6.0'; - -UPDATE "SENTRY_VERSION" SET "SCHEMA_VERSION"='1.6.0', "VERSION_COMMENT"='Sentry release version 1.6.0' WHERE "VER_ID"=1; - -SELECT 'Finished upgrading Sentry store schema from 1.5.0 to 1.6.0'; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.6.0-to-1.7.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.6.0-to-1.7.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.6.0-to-1.7.0.sql deleted file mode 100644 index ff10e10..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.6.0-to-1.7.0.sql +++ /dev/null @@ -1,5 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.6.0 to 1.7.0'; - -UPDATE "SENTRY_VERSION" SET "SCHEMA_VERSION"='1.7.0', "VERSION_COMMENT"='Sentry release version 1.7.0' WHERE "VER_ID"=1; - -SELECT 'Finished upgrading Sentry store schema from 1.6.0 to 1.7.0'; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.7.0-to-1.8.0.sql ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.7.0-to-1.8.0.sql b/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.7.0-to-1.8.0.sql deleted file mode 100644 index b39292d..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry-upgrade-postgres-1.7.0-to-1.8.0.sql +++ /dev/null @@ -1,6 +0,0 @@ -SELECT 'Upgrading Sentry store schema from 1.7.0 to 1.8.0'; -\i 006-SENTRY-711.postgres.sql; - -UPDATE "SENTRY_VERSION" SET "SCHEMA_VERSION"='1.8.0', "VERSION_COMMENT"='Sentry release version 1.8.0' WHERE "VER_ID"=1; - -SELECT 'Finished upgrading Sentry store schema from 1.7.0 to 1.8.0'; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift b/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift deleted file mode 100644 index 65c6934..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry_common_service.thrift +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/local/bin/thrift -java - -/** - * 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. - */ - -include "share/fb303/if/fb303.thrift" - -namespace java org.apache.sentry.service.thrift -namespace php sentry.service.thrift -namespace cpp Apache.Sentry.Service.Thrift - -const i32 TSENTRY_SERVICE_V1 = 1; -// Made a backward incompatible change when adding column level privileges. -// We also added generalized model in this version -const i32 TSENTRY_SERVICE_V2 = 2; - -const i32 TSENTRY_STATUS_OK = 0; -const i32 TSENTRY_STATUS_ALREADY_EXISTS = 1; -const i32 TSENTRY_STATUS_NO_SUCH_OBJECT = 2; -const i32 TSENTRY_STATUS_RUNTIME_ERROR = 3; -const i32 TSENTRY_STATUS_INVALID_INPUT = 4; -const i32 TSENTRY_STATUS_ACCESS_DENIED = 5; -const i32 TSENTRY_STATUS_THRIFT_VERSION_MISMATCH = 6; - -struct TSentryResponseStatus { -1: required i32 value, -// message will be set to empty string when status is OK -2: required string message -3: optional string stack -} - http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry_generic_policy_service.thrift ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry_generic_policy_service.thrift b/sentry-provider/sentry-provider-db/src/main/resources/sentry_generic_policy_service.thrift deleted file mode 100644 index db107bf..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry_generic_policy_service.thrift +++ /dev/null @@ -1,279 +0,0 @@ -#!/usr/local/bin/thrift -java - -/** - * 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. - */ - -# -# Thrift Service that the MetaStore is built on -# - -include "share/fb303/if/fb303.thrift" -include "sentry_common_service.thrift" -include "sentry_policy_service.thrift" - -namespace java org.apache.sentry.provider.db.generic.service.thrift -namespace php sentry.provider.db.service.db.generic.serivce.thrift -namespace cpp Apache.Sentry.Provider.Db.Generic.Service.Thrift - -typedef sentry_common_service.TSentryResponseStatus TSentryResponseStatus - -# Represents a new generic model privilege for solr or other component in transport -# from the client to the server -enum TSentryGrantOption { - TRUE = 1, - FALSE = 0, - UNSET = -1 -} - -# Represents a authorizable resource in the privilege -# like DATABASE=db1 in the hive, COLLECTION=collection1 in the solr -struct TAuthorizable { -1: required string type, -2: required string name -} - -struct TSentryPrivilege { -1: required string component, -2: required string serviceName, -3: required list<TAuthorizable> authorizables, -4: required string action, -5: optional i64 createTime, # Set on server side -6: optional string grantorPrincipal, # Set on server side -7: optional TSentryGrantOption grantOption = sentry_policy_service.TSentryGrantOption.FALSE -} - -# CREATE ROLE r1 -struct TCreateSentryRoleRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -4: required string component # The request is issued to which component -} - -struct TCreateSentryRoleResponse { -1: required TSentryResponseStatus status -} - -# DROP ROLE r1 -struct TDropSentryRoleRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -4: required string component # The request is issued to which component -} - -struct TDropSentryRoleResponse { -1: required TSentryResponseStatus status -} - -# GRANT ROLE r1 TO GROUP g1 -struct TAlterSentryRoleAddGroupsRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -4: required string component, # The request is issued to which component -5: required set<string> groups -} -struct TAlterSentryRoleAddGroupsResponse { -1: required TSentryResponseStatus status -} - -# REVOLE ROLE r1 FROM GROUP g1 -struct TAlterSentryRoleDeleteGroupsRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -4: required string component, # The request is issued to which component -5: required set<string> groups -} -struct TAlterSentryRoleDeleteGroupsResponse { -1: required TSentryResponseStatus status -} - -# GRANT ... ON ... TO ROLE ... -struct TAlterSentryRoleGrantPrivilegeRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -4: required string component, # The request is issued to which component -5: required TSentryPrivilege privilege -} -struct TAlterSentryRoleGrantPrivilegeResponse { -1: required TSentryResponseStatus status -} - -# REVOKE ... ON ... FROM ROLE ... -struct TAlterSentryRoleRevokePrivilegeRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -4: required string component, # The request is issued to which component -5: required TSentryPrivilege privilege -} -struct TAlterSentryRoleRevokePrivilegeResponse { -1: required TSentryResponseStatus status -} - -# SHOW ROLE GRANT -struct TListSentryRolesRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: optional string groupName, # for this group, or all roles for all groups if null -4: required string component # The request is issued to which component -} -# used only for TListSentryRolesResponse -struct TSentryRole { -1: required string roleName, -2: required set<string> groups -} - -struct TListSentryRolesResponse { -1: required TSentryResponseStatus status -2: optional set<TSentryRole> roles -} -# SHOW GRANT -struct TListSentryPrivilegesRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, # get privileges assigned for this role -4: required string component, # The request is issued to which component -5: required string serviceName, # The privilege belongs to which service -6: optional list<TAuthorizable> authorizables # get privileges assigned for this authorizable hierarchys -} - -struct TListSentryPrivilegesResponse { -1: required TSentryResponseStatus status -2: optional set<TSentryPrivilege> privileges -} - -# Drop privilege -struct TDropPrivilegesRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required TSentryPrivilege privilege -4: required string component, # The request is issued to which component -} - -struct TDropPrivilegesResponse { -1: required TSentryResponseStatus status -} - -# Rename privilege -struct TRenamePrivilegesRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string component, # The request is issued to which component -4: required string serviceName, # The privilege belongs to which service -5: required list<TAuthorizable> oldAuthorizables, # get old privileges assigned for this authorizable hierarchys -6: required list<TAuthorizable> newAuthorizables # change to new authorizable hierarchys -} - -struct TRenamePrivilegesResponse { -1: required TSentryResponseStatus status -} - -# This API was created specifically for ProviderBackend.getPrivileges -# and is not mean for general purpose privilege retrieval. -# This request/response pair are created specifically so we can -# efficiently obtain the specific privilges for a user query -struct TSentryActiveRoleSet { -1: required bool all, -2: required set<string> roles, -} - -struct TListSentryPrivilegesForProviderRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string component, # The request is issued to which component -3: required string serviceName, # The privilege belongs to which service -4: required set<string> groups, -5: required TSentryActiveRoleSet roleSet, -6: optional list<TAuthorizable> authorizables # authorizable hierarchys -} - -struct TListSentryPrivilegesForProviderResponse { -1: required TSentryResponseStatus status -2: required set<string> privileges -} - -# Map of role:set<privileges> for the given authorizable -# Optionally use the set of groups to filter the roles -struct TSentryPrivilegeMap { -1: required map<string, set<TSentryPrivilege>> privilegeMap -} - -struct TListSentryPrivilegesByAuthRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, - -# User on whose behalf the request is issued -2: required string requestorUserName, - -# The request is issued to which component -3: required string component, - -# The privilege belongs to which service -4: required string serviceName, - -# The authorizable hierarchys, it is represented as a string. e.g -# resourceType1=resourceName1->resourceType2=resourceName2->resourceType3=resourceName3 -5: required set<string> authorizablesSet, - -# The requested groups. For admin, the requested groups can be empty, if so it is -# treated as a wildcard query. Otherwise, it is a query on this specifc groups. -# For non-admin user, the requested groups must be the groups they are part of. -6: optional set<string> groups, - -# The active role set. -7: optional TSentryActiveRoleSet roleSet -} - -struct TListSentryPrivilegesByAuthResponse { -1: required sentry_common_service.TSentryResponseStatus status, - -# Will not be set in case of an error. Otherwise it will be a -# <Authorizables, <Role, Set<Privileges>>> mapping. For non-admin -# requestor, the roles are intersection of active roles and granted roles. -# For admin requestor, the roles are filtered based on the active roles -# and requested group from TListSentryPrivilegesByAuthRequest. -# The authorizable hierarchys is represented as a string in the form -# of the request. -2: optional map<string, TSentryPrivilegeMap> privilegesMapByAuth -} - -service SentryGenericPolicyService -{ - TCreateSentryRoleResponse create_sentry_role(1:TCreateSentryRoleRequest request) - TDropSentryRoleResponse drop_sentry_role(1:TDropSentryRoleRequest request) - - TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(1:TAlterSentryRoleGrantPrivilegeRequest request) - TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(1:TAlterSentryRoleRevokePrivilegeRequest request) - - TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(1:TAlterSentryRoleAddGroupsRequest request) - TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(1:TAlterSentryRoleDeleteGroupsRequest request) - - TListSentryRolesResponse list_sentry_roles_by_group(1:TListSentryRolesRequest request) - - TListSentryPrivilegesResponse list_sentry_privileges_by_role(1:TListSentryPrivilegesRequest request) - - TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(1:TListSentryPrivilegesForProviderRequest request) - - TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(1:TListSentryPrivilegesByAuthRequest request); - - TDropPrivilegesResponse drop_sentry_privilege(1:TDropPrivilegesRequest request); - - TRenamePrivilegesResponse rename_sentry_privilege(1:TRenamePrivilegesRequest request); -} http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift b/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift deleted file mode 100644 index 82cd947..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/sentry_policy_service.thrift +++ /dev/null @@ -1,330 +0,0 @@ -#!/usr/local/bin/thrift -java - -/** - * 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. - */ - -# -# Thrift Service that the MetaStore is built on -# - -include "share/fb303/if/fb303.thrift" -include "sentry_common_service.thrift" - -namespace java org.apache.sentry.provider.db.service.thrift -namespace php sentry.provider.db.service.thrift -namespace cpp Apache.Sentry.Provider.Db.Service.Thrift - -enum TSentryGrantOption { - TRUE = 1, - FALSE = 0, - # UNSET is used for revoke privilege, the component like 'hive' - # didn't support getting grant option, so use UNSET is stand - # for revoke both privileges with grant option and without grant - # option. - UNSET = -1 -} - -# Represents a Privilege in transport from the client to the server -struct TSentryPrivilege { -1: required string privilegeScope, # Valid values are SERVER, DATABASE, TABLE, COLUMN, URI -3: required string serverName, -4: optional string dbName = "", -5: optional string tableName = "", -6: optional string URI = "", -7: required string action = "", -8: optional i64 createTime, # Set on server side -9: optional TSentryGrantOption grantOption = TSentryGrantOption.FALSE -10: optional string columnName = "", -} - -# TODO can this be deleted? it's not adding value to TAlterSentryRoleAddGroupsRequest -struct TSentryGroup { -1: required string groupName -} - -# CREATE ROLE r1 -struct TCreateSentryRoleRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, # TSentryRole is not required for this request -} -struct TCreateSentryRoleResponse { -1: required sentry_common_service.TSentryResponseStatus status -} - -# DROP ROLE r1 -struct TDropSentryRoleRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName # role to drop -} -struct TDropSentryRoleResponse { -1: required sentry_common_service.TSentryResponseStatus status -} - -# GRANT ROLE r1 TO GROUP g1 -struct TAlterSentryRoleAddGroupsRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -5: required set<TSentryGroup> groups -} - -struct TAlterSentryRoleAddGroupsResponse { -1: required sentry_common_service.TSentryResponseStatus status -} - -# GRANT ROLE r1 TO USER u1 -struct TAlterSentryRoleAddUsersRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -4: required set<string> users -} - -struct TAlterSentryRoleAddUsersResponse { -1: required sentry_common_service.TSentryResponseStatus status -} - -# REVOKE ROLE r1 FROM GROUP g1 -struct TAlterSentryRoleDeleteGroupsRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -5: required set<TSentryGroup> groups -} -struct TAlterSentryRoleDeleteGroupsResponse { -1: required sentry_common_service.TSentryResponseStatus status -} - -# REVOKE ROLE r1 FROM USER u1 -struct TAlterSentryRoleDeleteUsersRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -4: required set<string> users -} -struct TAlterSentryRoleDeleteUsersResponse { -1: required sentry_common_service.TSentryResponseStatus status -} - -# GRANT ... ON ... TO ROLE ... -struct TAlterSentryRoleGrantPrivilegeRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -5: optional TSentryPrivilege privilege, -6: optional set<TSentryPrivilege> privileges -} -struct TAlterSentryRoleGrantPrivilegeResponse { -1: required sentry_common_service.TSentryResponseStatus status -2: optional TSentryPrivilege privilege -3: optional set<TSentryPrivilege> privileges -} - -# REVOKE ... ON ... FROM ROLE ... -struct TAlterSentryRoleRevokePrivilegeRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string roleName, -5: optional TSentryPrivilege privilege, -6: optional set<TSentryPrivilege> privileges -} -struct TAlterSentryRoleRevokePrivilegeResponse { -1: required sentry_common_service.TSentryResponseStatus status -} - -# SHOW ROLE GRANT -struct TListSentryRolesRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: optional string groupName # for this group, or all roles for all groups if null -} - -struct TListSentryRolesForUserRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required string userName -} - -# used only for TListSentryRolesResponse -struct TSentryRole { -1: required string roleName, -2: required set<TSentryGroup> groups, -3: required string grantorPrincipal #Deprecated -} -struct TListSentryRolesResponse { -1: required sentry_common_service.TSentryResponseStatus status -2: optional set<TSentryRole> roles -} - -struct TSentryAuthorizable { -1: required string server, -2: optional string uri, -3: optional string db, -4: optional string table, -5: optional string column, -} - -# SHOW GRANT -struct TListSentryPrivilegesRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -4: required string roleName, # get privileges assigned for this role -5: optional TSentryAuthorizable authorizableHierarchy # get privileges assigned for this role -} -struct TListSentryPrivilegesResponse { -1: required sentry_common_service.TSentryResponseStatus status -2: optional set<TSentryPrivilege> privileges -} - -# Drop privilege -struct TDropPrivilegesRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required TSentryAuthorizable authorizable -} - -struct TDropPrivilegesResponse { -1: required sentry_common_service.TSentryResponseStatus status -} - -struct TRenamePrivilegesRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required TSentryAuthorizable oldAuthorizable -4: required TSentryAuthorizable newAuthorizable -} - -struct TRenamePrivilegesResponse { -1: required sentry_common_service.TSentryResponseStatus status -} - -# This API was created specifically for ProviderBackend.getPrivileges -# and is not mean for general purpose privilege retrieval. -# This request/response pair are created specifically so we can -# efficiently obtain the specific privilges for a user query -struct TSentryActiveRoleSet { -1: required bool all, -2: required set<string> roles, -} -struct TListSentryPrivilegesForProviderRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required set<string> groups, -3: required TSentryActiveRoleSet roleSet, -4: optional TSentryAuthorizable authorizableHierarchy, -5: optional set<string> users -} -struct TListSentryPrivilegesForProviderResponse { -1: required sentry_common_service.TSentryResponseStatus status -2: required set<string> privileges -} - -# List role:set<privileges> for the given authorizable -# Optionally use the set of groups to filter the roles -struct TSentryPrivilegeMap { -1: required map<string, set<TSentryPrivilege>> privilegeMap -} -struct TListSentryPrivilegesByAuthRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required set<TSentryAuthorizable> authorizableSet, -4: optional set<string> groups, -5: optional TSentryActiveRoleSet roleSet -} -struct TListSentryPrivilegesByAuthResponse { -1: required sentry_common_service.TSentryResponseStatus status, -2: optional map<TSentryAuthorizable, TSentryPrivilegeMap> privilegesMapByAuth # will not be set in case of an error -} - -# Obtain a config value from the Sentry service -struct TSentryConfigValueRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V2, -2: required string propertyName, # Config attribute to obtain -3: optional string defaultValue # Value if propertyName not found -} -struct TSentryConfigValueResponse { -1: required sentry_common_service.TSentryResponseStatus status -2: optional string value -} - -# struct for the mapping data like group to role, role to privilege -struct TSentryMappingData { -1: optional map<string, set<string>> groupRolesMap, # for the groupName -> role mapping -2: optional map<string, set<TSentryPrivilege>> rolePrivilegesMap, # for the roleName -> privilege mapping -3: optional map<string, set<string>> userRolesMap # for the userName -> role mapping -} - -struct TSentryExportMappingDataRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1, -2: required string requestorUserName, # user on whose behalf the request is issued -3: optional string objectPath # for specific auth object -} - -struct TSentryExportMappingDataResponse { -1: required sentry_common_service.TSentryResponseStatus status, -2: required TSentryMappingData mappingData -} - -struct TSentryImportMappingDataRequest { -1: required i32 protocol_version = sentry_common_service.TSENTRY_SERVICE_V1, -2: required string requestorUserName, # user on whose behalf the request is issued -3: required bool overwriteRole = false, # if overwrite the exist role with the imported privileges, default is false -4: required TSentryMappingData mappingData -} - -struct TSentryImportMappingDataResponse { -1: required sentry_common_service.TSentryResponseStatus status -} - -service SentryPolicyService -{ - TCreateSentryRoleResponse create_sentry_role(1:TCreateSentryRoleRequest request) - TDropSentryRoleResponse drop_sentry_role(1:TDropSentryRoleRequest request) - - TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(1:TAlterSentryRoleGrantPrivilegeRequest request) - TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(1:TAlterSentryRoleRevokePrivilegeRequest request) - - TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(1:TAlterSentryRoleAddGroupsRequest request) - TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(1:TAlterSentryRoleDeleteGroupsRequest request) - - TAlterSentryRoleAddUsersResponse alter_sentry_role_add_users(1:TAlterSentryRoleAddUsersRequest request) - TAlterSentryRoleDeleteUsersResponse alter_sentry_role_delete_users(1:TAlterSentryRoleDeleteUsersRequest request) - - TListSentryRolesResponse list_sentry_roles_by_group(1:TListSentryRolesRequest request) - TListSentryRolesResponse list_sentry_roles_by_user(1:TListSentryRolesForUserRequest request) - - TListSentryPrivilegesResponse list_sentry_privileges_by_role(1:TListSentryPrivilegesRequest request) - - # For use with ProviderBackend.getPrivileges only - TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(1:TListSentryPrivilegesForProviderRequest request) - - TDropPrivilegesResponse drop_sentry_privilege(1:TDropPrivilegesRequest request); - - TRenamePrivilegesResponse rename_sentry_privilege(1:TRenamePrivilegesRequest request); - - TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(1:TListSentryPrivilegesByAuthRequest request); - - TSentryConfigValueResponse get_sentry_config_value(1:TSentryConfigValueRequest request); - - # export the mapping data in sentry - TSentryExportMappingDataResponse export_sentry_mapping_data(1:TSentryExportMappingDataRequest request); - - # import the mapping data in sentry - TSentryImportMappingDataResponse import_sentry_mapping_data(1:TSentryImportMappingDataRequest request); -} http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/upgrade.order.db2 ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/upgrade.order.db2 b/sentry-provider/sentry-provider-db/src/main/resources/upgrade.order.db2 deleted file mode 100644 index 8da8c9c..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/upgrade.order.db2 +++ /dev/null @@ -1,4 +0,0 @@ -1.4.0-to-1.5.0 -1.5.0-to-1.6.0 -1.6.0-to-1.7.0 -1.7.0-to-1.8.0 http://git-wip-us.apache.org/repos/asf/sentry/blob/f1332300/sentry-provider/sentry-provider-db/src/main/resources/upgrade.order.derby ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/resources/upgrade.order.derby b/sentry-provider/sentry-provider-db/src/main/resources/upgrade.order.derby deleted file mode 100644 index 8da8c9c..0000000 --- a/sentry-provider/sentry-provider-db/src/main/resources/upgrade.order.derby +++ /dev/null @@ -1,4 +0,0 @@ -1.4.0-to-1.5.0 -1.5.0-to-1.6.0 -1.6.0-to-1.7.0 -1.7.0-to-1.8.0
