27 lines
837 B
SQL
27 lines
837 B
SQL
-- +goose Up
|
|
CREATE SCHEMA drafts;
|
|
|
|
CREATE TABLE drafts.drafts (
|
|
id uuid PRIMARY KEY,
|
|
org_id text NOT NULL,
|
|
group_id uuid NOT NULL,
|
|
name text NOT NULL,
|
|
source text NOT NULL,
|
|
event_type text NOT NULL,
|
|
filter jsonb NOT NULL,
|
|
document text NOT NULL,
|
|
policy_kind text NOT NULL CHECK (policy_kind IN ('hard_rules', 'change_request')),
|
|
policy text NOT NULL,
|
|
dry_run_id uuid,
|
|
dry_event_id uuid,
|
|
installed_version integer,
|
|
published_at timestamptz,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
UNIQUE (org_id, group_id),
|
|
UNIQUE (org_id, name)
|
|
);
|
|
|
|
-- +goose Down
|
|
DROP SCHEMA drafts CASCADE;
|