74 lines
2.5 KiB
SQL
74 lines
2.5 KiB
SQL
CREATE TABLE plugin_private_adoption_forgejo_issue_sync_5fd4e14106.forgejo_sync_state (
|
|
key text PRIMARY KEY,
|
|
value jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
updated_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE TABLE plugin_private_adoption_forgejo_issue_sync_5fd4e14106.webhook_deliveries (
|
|
request_id text PRIMARY KEY,
|
|
delivery_key text NOT NULL,
|
|
event_name text NOT NULL,
|
|
company_id uuid NOT NULL,
|
|
payload jsonb NOT NULL,
|
|
status text NOT NULL,
|
|
received_at timestamptz NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE TABLE plugin_private_adoption_forgejo_issue_sync_5fd4e14106.issue_mappings (
|
|
company_id uuid NOT NULL,
|
|
paperclip_issue_id uuid NOT NULL,
|
|
forgejo_issue_id bigint,
|
|
forgejo_issue_number integer,
|
|
forgejo_issue_url text,
|
|
forgejo_api_url text,
|
|
repo_owner text NOT NULL,
|
|
repo_name text NOT NULL,
|
|
dedupe_key text NOT NULL,
|
|
source_title text NOT NULL,
|
|
source_body text NOT NULL,
|
|
attachment_metadata jsonb NOT NULL DEFAULT '[]'::jsonb,
|
|
manual_review_required boolean NOT NULL DEFAULT false,
|
|
review_reason_code text,
|
|
sync_status text NOT NULL DEFAULT 'pending',
|
|
last_error text,
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (company_id, paperclip_issue_id)
|
|
);
|
|
|
|
CREATE TABLE plugin_private_adoption_forgejo_issue_sync_5fd4e14106.comment_mappings (
|
|
company_id uuid NOT NULL,
|
|
source_id text NOT NULL,
|
|
dedupe_key text NOT NULL,
|
|
title text,
|
|
body text NOT NULL,
|
|
attachment_metadata jsonb NOT NULL DEFAULT '[]'::jsonb,
|
|
manual_review_required boolean NOT NULL DEFAULT false,
|
|
review_reason_code text,
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (company_id, source_id)
|
|
);
|
|
|
|
CREATE TABLE plugin_private_adoption_forgejo_issue_sync_5fd4e14106.review_queue (
|
|
company_id uuid NOT NULL,
|
|
source_kind text NOT NULL,
|
|
source_id text NOT NULL,
|
|
dedupe_key text NOT NULL,
|
|
review_reason_code text NOT NULL,
|
|
review_payload jsonb NOT NULL,
|
|
status text NOT NULL DEFAULT 'pending',
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
PRIMARY KEY (company_id, source_kind, source_id)
|
|
);
|
|
|
|
CREATE TABLE plugin_private_adoption_forgejo_issue_sync_5fd4e14106.reconciliation_runs (
|
|
id bigserial PRIMARY KEY,
|
|
completed_at timestamptz NOT NULL,
|
|
trigger text NOT NULL,
|
|
pending_reviews integer NOT NULL,
|
|
pending_deliveries integer NOT NULL,
|
|
mapped_issues integer NOT NULL,
|
|
mapped_comments integer NOT NULL,
|
|
snapshot jsonb NOT NULL
|
|
);
|