Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions scripts/sql/182_resource_filter_v2.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BEGIN;
-- drop tables
DROP TABLE IF EXISTS resource_filter_audit;
DROP TABLE IF EXISTS resource_filter_evaluation_audit;
-- drop sequences
DROP SEQUENCE IF EXISTS public.resource_filter_audit_seq;
DROP SEQUENCE IF EXISTS public.resource_filter_evaluation_audit_seq;
COMMIT;
35 changes: 35 additions & 0 deletions scripts/sql/182_resource_filter_v2.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
BEGIN;
-- create resource filter audit table
CREATE SEQUENCE IF NOT EXISTS resource_filter_audit_seq;
CREATE TABLE IF NOT EXISTS "public"."resource_filter_audit"
(
"id" integer not null default nextval('resource_filter_audit_seq' :: regclass),
"target_object" integer NOT NULL,
"conditions" text NOT NULL,
"filter_id" int NOT NULL,
"action" int NOT NULL,
"created_on" timestamptz,
"created_by" integer,
"updated_on" timestamptz,
"updated_by" integer,
CONSTRAINT "resource_filter_audit_filter_id_fkey" FOREIGN KEY ("filter_id") REFERENCES "public"."resource_filter" ("id"),
PRIMARY KEY ("id")
);

-- create resource filter evaluation audit table
CREATE SEQUENCE IF NOT EXISTS resource_filter_evaluation_audit_seq;
CREATE TABLE IF NOT EXISTS "public"."resource_filter_evaluation_audit"
(
"id" integer not null default nextval('resource_filter_evaluation_audit_seq' :: regclass),
"reference_type" integer NOT NULL,
"reference_id" integer NOT NULL,
"filter_history_objects" text NOT NULL,
"subject_type" int NOT NULL,
"subject_id" int NOT NULL,
"created_on" timestamptz,
"created_by" integer,
"updated_on" timestamptz,
"updated_by" integer,
PRIMARY KEY ("id")
);
COMMIT;