diff --git a/docs/review-live-proof.md b/docs/review-live-proof.md new file mode 100644 index 0000000..2b59daa --- /dev/null +++ b/docs/review-live-proof.md @@ -0,0 +1,132 @@ +# Review live-transport proof + +This is a runnable proof procedure, **not execution evidence**. A successful +offline preflight or unit test is not live proof. Do not remove those labels +until the corresponding run has produced an inspected artifact. + +## Scope + +`scripts/proof-review-live.ts` invokes unchanged production delivery, +synchronization, and outstanding-write recovery functions using Carbon's real +Discord REST client. It creates one synthetic card in an empty test text +channel, verifies every payload with real GETs, and leaves the card intact. +The database is a fresh **local Wrangler D1 binding**, not deployed D1. The +synthetic archive goes through the actual authenticated forwarder HTTP bridge. +The bridge has a random per-run bearer secret and is stopped afterward. + +The test account being assessed is the test bot itself. Its input is generated +fixture text, never channel history or real member telemetry. Only the +configured channel is accessed. Production review guild/channel IDs are refused. +Card comparisons ignore server-assigned component IDs and treat an omitted +button `disabled` flag as false; true and every rendered field remain checked. +The runner overrides review coordinates in its own process; production files, +bot endpoint, command registrations, and deployed services remain unchanged. + +## Required configuration + +Provide these to the process through the authorized runtime credential facility. +Do not paste tokens into chat, command lines, artifacts, or source files. + +- `HERMIT_PROOF_GUILD_ID`: authorized nonproduction guild. +- `HERMIT_PROOF_CHANNEL_ID`: empty dedicated text channel in that guild. +- `DISCORD_CLIENT_ID` and `DISCORD_BOT_TOKEN`: existing authorized test bot. +- `OPENAI_API_KEY`: only if the optional paid provider proof is authorized. + +Automatic screening must remain disabled. Do not change any existing bot's +interaction endpoint or redeploy its commands for this runner. If OpenClaw +requires Discord-scoped execution, launch from that actual conversation; do +not extract file-backed credentials to bypass the scope restriction. + +Run from a **clean committed tree** (Bun on PATH): + +```sh +bun --no-env-file scripts/proof-review-live.ts --preflight +bun --no-env-file scripts/proof-review-live.ts --live +``` + +To additionally exercise the unchanged evaluator and its real provider request, +use `--live --provider` instead of `--live`. This can make the configured primary +request and its fallback, and spends API credit. Both HTTP results and the +provider's returned model name are recorded; do not label fallback output as the +primary model. The runner never installs or claims a separate Krill service. + +## Decisive sequence + +1. Verify the token's bot identity, the channel's guild, and that the channel is + empty. Apply migrations to fresh local D1. Fetch 24 synthetic observations + through the authenticated production Discrawl bridge and analyze them. +2. Optionally request a real provider assessment. Create the case and deliver a + card through `postReviewEscalationCard`. Fetch and compare the exact card. + This is the normal-delivery preservation control. +3. Enter production `syncSharedReviewCard` for an older assessment. At the + transport seam, hold its PATCH after production persisted the write ledger. + Leave its caller unresolved: neither catch nor acknowledgment may run. +4. Save and synchronize a newer assessment. GET verifies the newer payload. + Honor the actual 120-second due time, run outstanding-write recovery, GET + verifies the card, and assert the original ledger is still present. +5. Forward the held PATCH through the original Carbon REST client. A real GET + must now show the stale payload. Keep the original caller unresolved. Honor + the next actual backoff, run recovery again, and GET must show latest state. +6. Assert desired/synced revisions match, the original unresolved ledger remains, + and the test channel contains only the original card—not a replacement. + +The barrier controls the ordering; waits only honor production retry eligibility. +No fake Discord responses, fabricated acknowledgment, clock rewrite, or fabricated +due timestamp is used. This injects a delayed/unacknowledged transport outcome; +it is **not** an actual Worker termination or proof about Discord latency bounds. + +## Artifacts and limits + +The private run directory is printed at exit under +`$XDG_STATE_HOME/hermit-live-proof/` (or `~/.local/state/...`). It retains +`evidence.jsonl`, the synthetic fixture, generated local-only Wrangler config, +and local D1 state. A failure is recorded as failure. Proxies are disposed before +exit. No cleanup deletes remote cards or receipts automatically; inspect the +record before retrying, and use another empty test channel if needed. + +Inspect and redact artifacts before PR publication. Evidence records HEAD, +ordering, actual GET assertions, revisions, retained obligations, provider +response model, and hashes. Never publish credentials, private endpoints, or +unrelated logs. Do not publish private Discord IDs without owner permission. + +Still separate, even after this runner passes: + +- Real `/review` and button ingress through the production Worker/Carbon router. + Capture an authorized staff test action, stale-button rejection, the D1 + decision, and shared-card GET readback. Do not fabricate signed Discord events. +- Deployed staging Worker/D1 evidence, if required by the current review. +- An executed red baseline with the same transport harness; this script does + not assert one ran or silently disable production checks to simulate it. +- Pilot policy sponsorship and upstream CI approval. + +Update `## Real Behavior Proof` with only the observed scope, exact tested HEAD, +command, relevant output, inspected artifact, and these explicit limits. + +## Actual Gateway interaction proof + +`bun --no-env-file scripts/proof-review-interactions.ts --live` is a separate +opt-in ingress runner, not a claim of a completed run. It requires the same test +configuration plus `HERMIT_PROOF_ACTOR_IDS` (comma-separated authorized owners) and +`HERMIT_PROOF_STAFF_ROLE_ID` (operator-created zero-permission test role). +It refuses an existing guild `/review` command or an application with an HTTP +interaction endpoint. It adds only its own temporary guild command and maps the existing test role +as staff inside the test process. The actual actor starts without that role. +After a genuine rejected command, the owner assigns the role through Discord +for the authorized control. It deletes its own command in `finally`, including +failure/timeout cleanup. The owner must remove the temporary role afterward; +the bot is not granted role-management privileges. + +It uses a separate zero-intent Carbon Gateway connection, listens only for test +channel/actor interactions, and passes their actual payloads unchanged to the +same Carbon interaction router used by the Worker. The production command and +button handlers are unchanged. Existing bot configuration, global commands, +and interaction endpoint are not modified. No message history is ingested. + +In the authorized browser, run `/review user:` twice (first denied, +then allowed), click Dismiss on the now-stale ephemeral command card, then click +Dismiss on the current shared card. The runner asserts real webhook responses, +D1 denial/preservation/decision, and exact real shared-card GET readback. Never +fabricate a Discord event or interaction token. Artifacts remain private under +`~/.local/state/hermit-interaction-proof/`. This exercises real Gateway ingress, +not deployed Worker HTTP signature validation. Provider execution is excluded +and `OPENAI_API_KEY` must be absent to keep that proof independent. diff --git a/drizzle/0013_reflective_rictor.sql b/drizzle/0013_reflective_rictor.sql new file mode 100644 index 0000000..4498bbe --- /dev/null +++ b/drizzle/0013_reflective_rictor.sql @@ -0,0 +1,52 @@ +CREATE TABLE `review_cases` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `case_id` text NOT NULL, + `guild_id` text NOT NULL, + `target_user_id` text NOT NULL, + `status` text DEFAULT 'open' NOT NULL, + `heuristic_score` integer NOT NULL, + `concordance` text NOT NULL, + `behavioral_families` text NOT NULL, + `evidence_message_id` text, + `krill_probability` text, + `krill_brief` text, + `krill_model` text, + `review_message_id` text, + `review_channel_id` text, + `delivery_status` text DEFAULT 'pending' NOT NULL, + `previous_delivery_status` text DEFAULT 'pending' NOT NULL, + `card_revision` integer DEFAULT 1 NOT NULL, + `synced_card_revision` integer DEFAULT 1 NOT NULL, + `expires_at` text, + `decided_by_id` text, + `decision_reason` text, + `created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL, + `updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL +); +--> statement-breakpoint +CREATE UNIQUE INDEX `review_cases_case_id_unique` ON `review_cases` (`case_id`);--> statement-breakpoint +CREATE INDEX `idx_review_cases_guild_target` ON `review_cases` (`guild_id`,`target_user_id`);--> statement-breakpoint +CREATE INDEX `idx_review_cases_status` ON `review_cases` (`status`);--> statement-breakpoint +CREATE INDEX `idx_review_cases_review_msg` ON `review_cases` (`review_message_id`);--> statement-breakpoint +CREATE TABLE `review_observations` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `message_id` text NOT NULL, + `guild_id` text NOT NULL, + `channel_id` text NOT NULL, + `author_id` text NOT NULL, + `created_at` text NOT NULL, + `reply_to_id` text, + `content_length` integer NOT NULL, + `line_count` integer NOT NULL, + `fingerprint` text NOT NULL, + `artifacts` text NOT NULL, + `similarity` text, + `semantic_score` integer, + `received_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL +); +--> statement-breakpoint +CREATE UNIQUE INDEX `review_observations_message_id_unique` ON `review_observations` (`message_id`);--> statement-breakpoint +CREATE INDEX `idx_review_obs_guild_author` ON `review_observations` (`guild_id`,`author_id`,`created_at`);--> statement-breakpoint +CREATE INDEX `idx_review_obs_author` ON `review_observations` (`author_id`,`created_at`);--> statement-breakpoint +CREATE INDEX `idx_review_obs_channel` ON `review_observations` (`channel_id`,`created_at`);--> statement-breakpoint +CREATE INDEX `idx_review_obs_message` ON `review_observations` (`message_id`); \ No newline at end of file diff --git a/drizzle/0014_review_recovery_ownership.sql b/drizzle/0014_review_recovery_ownership.sql new file mode 100644 index 0000000..7df206b --- /dev/null +++ b/drizzle/0014_review_recovery_ownership.sql @@ -0,0 +1,11 @@ +ALTER TABLE `review_cases` ADD `delivery_nonce` text;--> statement-breakpoint +ALTER TABLE `review_cases` ADD `delivery_claim_token` text;--> statement-breakpoint +ALTER TABLE `review_cases` ADD `delivery_claim_expires_at` text;--> statement-breakpoint +ALTER TABLE `review_cases` ADD `receipt_claim_token` text;--> statement-breakpoint +ALTER TABLE `review_cases` ADD `receipt_claim_expires_at` text;--> statement-breakpoint +ALTER TABLE `review_cases` ADD `receipt_next_attempt_at` text;--> statement-breakpoint +ALTER TABLE `review_cases` ADD `receipt_history_before` text;--> statement-breakpoint +ALTER TABLE `review_cases` ADD `card_sync_next_attempt_at` text;--> statement-breakpoint +ALTER TABLE `review_cases` ADD `card_sync_failure_count` integer DEFAULT 0 NOT NULL;--> statement-breakpoint +CREATE INDEX `idx_review_cases_receipt_recovery` ON `review_cases` (`guild_id`,`delivery_status`,`receipt_next_attempt_at`,`receipt_claim_expires_at`);--> statement-breakpoint +CREATE INDEX `idx_review_cases_card_sync_due` ON `review_cases` (`card_sync_next_attempt_at`,`card_revision`,`synced_card_revision`); \ No newline at end of file diff --git a/drizzle/0015_review_delivery_attempt_state.sql b/drizzle/0015_review_delivery_attempt_state.sql new file mode 100644 index 0000000..811b39f --- /dev/null +++ b/drizzle/0015_review_delivery_attempt_state.sql @@ -0,0 +1,2 @@ +ALTER TABLE `review_cases` ADD `delivery_preflight_completed_at` text;--> statement-breakpoint +ALTER TABLE `review_cases` ADD `delivery_post_attempted_at` text; \ No newline at end of file diff --git a/drizzle/0016_chilly_loners.sql b/drizzle/0016_chilly_loners.sql new file mode 100644 index 0000000..8e59ac4 --- /dev/null +++ b/drizzle/0016_chilly_loners.sql @@ -0,0 +1 @@ +ALTER TABLE `review_cases` ADD `key_signals` text DEFAULT '[]' NOT NULL; \ No newline at end of file diff --git a/drizzle/0017_optimal_leopardon.sql b/drizzle/0017_optimal_leopardon.sql new file mode 100644 index 0000000..0de3cb2 --- /dev/null +++ b/drizzle/0017_optimal_leopardon.sql @@ -0,0 +1,17 @@ +CREATE TABLE `review_card_write_attempts` ( + `attempt_token` text PRIMARY KEY NOT NULL, + `case_id` text NOT NULL, + `guild_id` text NOT NULL, + `channel_id` text NOT NULL, + `message_id` text NOT NULL, + `rendered_revision` integer NOT NULL, + `claim_token` text, + `claim_expires_at` text, + `next_attempt_at` text, + `failure_count` integer DEFAULT 0 NOT NULL, + `created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL +); +--> statement-breakpoint +CREATE INDEX `idx_review_card_write_attempts_due` ON `review_card_write_attempts` (`guild_id`,`next_attempt_at`,`claim_expires_at`,`created_at`);--> statement-breakpoint +CREATE INDEX `idx_review_card_write_attempts_case` ON `review_card_write_attempts` (`case_id`);--> statement-breakpoint +ALTER TABLE `review_cases` ADD `delivery_attempt_state` text DEFAULT 'legacy_unknown' NOT NULL; \ No newline at end of file diff --git a/drizzle/meta/0013_snapshot.json b/drizzle/meta/0013_snapshot.json new file mode 100644 index 0000000..8de1a1a --- /dev/null +++ b/drizzle/meta/0013_snapshot.json @@ -0,0 +1,2384 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "8c3f7a82-5471-4f0d-9035-fcbf634c3a6f", + "prevId": "7b092a3e-2125-4013-999e-e32da449f6a3", + "tables": { + "action_cooldown_events": { + "name": "action_cooldown_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action_kind": { + "name": "action_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor_expires_at": { + "name": "actor_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_expires_at": { + "name": "target_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_expires_at": { + "name": "channel_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "action_cooldown_events_interaction_id_unique": { + "name": "action_cooldown_events_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "idx_action_cooldowns_actor": { + "name": "idx_action_cooldowns_actor", + "columns": [ + "guild_id", + "actor_id", + "actor_expires_at" + ], + "isUnique": false + }, + "idx_action_cooldowns_target": { + "name": "idx_action_cooldowns_target", + "columns": [ + "guild_id", + "target_id", + "target_expires_at" + ], + "isUnique": false + }, + "idx_action_cooldowns_channel": { + "name": "idx_action_cooldowns_channel", + "columns": [ + "guild_id", + "channel_id", + "channel_expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "claim_requests": { + "name": "claim_requests", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "github_username": { + "name": "github_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "merged_pr_count": { + "name": "merged_pr_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_thread_id": { + "name": "review_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_at": { + "name": "decided_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_claim_requests_guild_user": { + "name": "idx_claim_requests_guild_user", + "columns": [ + "guild_id", + "user_id" + ], + "isUnique": true + }, + "idx_claim_requests_user_id": { + "name": "idx_claim_requests_user_id", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "idx_claim_requests_status": { + "name": "idx_claim_requests_status", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_cases": { + "name": "clawhub_content_rights_cases", + "columns": { + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "form_submission_id": { + "name": "form_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "requester_name": { + "name": "requester_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organization": { + "name": "organization", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "clawhub_urls": { + "name": "clawhub_urls", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "explanation": { + "name": "explanation", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "clawhub_content_rights_cases_form_submission_id_unique": { + "name": "clawhub_content_rights_cases_form_submission_id_unique", + "columns": [ + "form_submission_id" + ], + "isUnique": true + }, + "idx_clawhub_content_rights_cases_status": { + "name": "idx_clawhub_content_rights_cases_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_clawhub_content_rights_cases_email": { + "name": "idx_clawhub_content_rights_cases_email", + "columns": [ + "email" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_events": { + "name": "clawhub_content_rights_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor": { + "name": "actor", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_clawhub_content_rights_events_case_id": { + "name": "idx_clawhub_content_rights_events_case_id", + "columns": [ + "case_id" + ], + "isUnique": false + }, + "idx_clawhub_content_rights_events_event_type": { + "name": "idx_clawhub_content_rights_events_event_type", + "columns": [ + "event_type" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_files": { + "name": "clawhub_content_rights_files", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "object_key": { + "name": "object_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_name": { + "name": "original_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "size_bytes": { + "name": "size_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "clawhub_content_rights_files_object_key_unique": { + "name": "clawhub_content_rights_files_object_key_unique", + "columns": [ + "object_key" + ], + "isUnique": true + }, + "idx_clawhub_content_rights_files_case_id": { + "name": "idx_clawhub_content_rights_files_case_id", + "columns": [ + "case_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "form_submissions": { + "name": "form_submissions", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "form_id": { + "name": "form_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "auth_provider": { + "name": "auth_provider", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applicant_id": { + "name": "applicant_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applicant_username": { + "name": "applicant_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_channel_id": { + "name": "review_channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_thread_id": { + "name": "review_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_at": { + "name": "decided_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "action_result": { + "name": "action_result", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_form_submissions_form_id": { + "name": "idx_form_submissions_form_id", + "columns": [ + "form_id" + ], + "isUnique": false + }, + "idx_form_submissions_status": { + "name": "idx_form_submissions_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_form_submissions_applicant_id": { + "name": "idx_form_submissions_applicant_id", + "columns": [ + "applicant_id" + ], + "isUnique": false + }, + "idx_form_submissions_review_message_id": { + "name": "idx_form_submissions_review_message_id", + "columns": [ + "review_message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "helper_events": { + "name": "helper_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'helper_command'" + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message_count": { + "name": "message_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "event_time": { + "name": "event_time", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "command": { + "name": "command", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "invoked_by_id": { + "name": "invoked_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoked_by_username": { + "name": "invoked_by_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoked_by_global_name": { + "name": "invoked_by_global_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_helper_events_event_time": { + "name": "idx_helper_events_event_time", + "columns": [ + "event_time" + ], + "isUnique": false + }, + "idx_helper_events_command": { + "name": "idx_helper_events_command", + "columns": [ + "command" + ], + "isUnique": false + }, + "idx_helper_events_thread_id": { + "name": "idx_helper_events_thread_id", + "columns": [ + "thread_id" + ], + "isUnique": false + }, + "idx_helper_events_invoked_by_id": { + "name": "idx_helper_events_invoked_by_id", + "columns": [ + "invoked_by_id" + ], + "isUnique": false + }, + "idx_helper_events_event_type": { + "name": "idx_helper_events_event_type", + "columns": [ + "event_type" + ], + "isUnique": false + }, + "idx_helper_events_thread_time": { + "name": "idx_helper_events_thread_time", + "columns": [ + "thread_id", + "event_time" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "keyValue": { + "name": "keyValue", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "lobster_encounters": { + "name": "lobster_encounters", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cooldown_event_id": { + "name": "cooldown_event_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_is_bot": { + "name": "target_is_bot", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "taxonomy_snapshot_id": { + "name": "taxonomy_snapshot_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_aphia_id": { + "name": "species_aphia_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_accepted_name": { + "name": "species_accepted_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_display_name": { + "name": "species_display_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_family": { + "name": "species_family", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scene_id": { + "name": "scene_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_url": { + "name": "asset_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_checksum": { + "name": "asset_checksum", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headline": { + "name": "headline", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "narrative": { + "name": "narrative", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metrics_json": { + "name": "metrics_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accessibility_description": { + "name": "accessibility_description", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "publication_status": { + "name": "publication_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "publication_failure": { + "name": "publication_failure", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "publication_failed_at": { + "name": "publication_failed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message_bound_at": { + "name": "message_bound_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_status": { + "name": "response_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "response_type": { + "name": "response_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_actor_id": { + "name": "response_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "responded_at": { + "name": "responded_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_result_json": { + "name": "response_result_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_actor_id": { + "name": "counter_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_target_id": { + "name": "counter_target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_scene_id": { + "name": "counter_scene_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_asset_url": { + "name": "counter_asset_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_asset_checksum": { + "name": "counter_asset_checksum", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_headline": { + "name": "counter_headline", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_narrative": { + "name": "counter_narrative", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_metrics_json": { + "name": "counter_metrics_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_accessibility_description": { + "name": "counter_accessibility_description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "lobster_encounters_interaction_id_unique": { + "name": "lobster_encounters_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "lobster_encounters_cooldown_event_id_unique": { + "name": "lobster_encounters_cooldown_event_id_unique", + "columns": [ + "cooldown_event_id" + ], + "isUnique": true + }, + "idx_lobster_encounters_message": { + "name": "idx_lobster_encounters_message", + "columns": [ + "guild_id", + "channel_id", + "message_id" + ], + "isUnique": false + }, + "idx_lobster_encounters_species": { + "name": "idx_lobster_encounters_species", + "columns": [ + "species_aphia_id" + ], + "isUnique": false + }, + "idx_lobster_encounters_publication": { + "name": "idx_lobster_encounters_publication", + "columns": [ + "publication_status" + ], + "isUnique": false + }, + "idx_lobster_encounters_response": { + "name": "idx_lobster_encounters_response", + "columns": [ + "response_status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "nomination_approvals": { + "name": "nomination_approvals", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "nomination_id": { + "name": "nomination_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "approver_id": { + "name": "approver_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "vote_choice": { + "name": "vote_choice", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'approve'" + }, + "mutation_id": { + "name": "mutation_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_nomination_approvals_nomination_approver": { + "name": "idx_nomination_approvals_nomination_approver", + "columns": [ + "nomination_id", + "approver_id" + ], + "isUnique": true + }, + "idx_nomination_approvals_nomination_id": { + "name": "idx_nomination_approvals_nomination_id", + "columns": [ + "nomination_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "nominations": { + "name": "nominations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nominee_id": { + "name": "nominee_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nominator_id": { + "name": "nominator_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'No reason provided.'" + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_role_id": { + "name": "target_role_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "required_approvals": { + "name": "required_approvals", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "completed_at": { + "name": "completed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "desired_card_revision": { + "name": "desired_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "synced_card_revision": { + "name": "synced_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "card_sync_started_at": { + "name": "card_sync_started_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_sync_failure_count": { + "name": "card_sync_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "grant_started_at": { + "name": "grant_started_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "grant_failure_count": { + "name": "grant_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_nominations_active_unique": { + "name": "idx_nominations_active_unique", + "columns": [ + "guild_id", + "nominee_id", + "target_role_id" + ], + "isUnique": true, + "where": "\"nominations\".\"status\" in ('submitted', 'granting')" + }, + "idx_nominations_status": { + "name": "idx_nominations_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_nominations_card_sync": { + "name": "idx_nominations_card_sync", + "columns": [ + "desired_card_revision", + "synced_card_revision" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "reddit_moderation_contexts": { + "name": "reddit_moderation_contexts", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "subreddit": { + "name": "subreddit", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'moderated'" + }, + "unaction": { + "name": "unaction", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'reviewed'" + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "moderator": { + "name": "moderator", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banned_at": { + "name": "banned_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_reddit_moderation_contexts_subreddit_username": { + "name": "idx_reddit_moderation_contexts_subreddit_username", + "columns": [ + "subreddit", + "username" + ], + "isUnique": true + }, + "idx_reddit_moderation_contexts_username": { + "name": "idx_reddit_moderation_contexts_username", + "columns": [ + "username" + ], + "isUnique": false + }, + "idx_reddit_moderation_contexts_action": { + "name": "idx_reddit_moderation_contexts_action", + "columns": [ + "action" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_cases": { + "name": "review_cases", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_user_id": { + "name": "target_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'open'" + }, + "heuristic_score": { + "name": "heuristic_score", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "concordance": { + "name": "concordance", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "behavioral_families": { + "name": "behavioral_families", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "evidence_message_id": { + "name": "evidence_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_probability": { + "name": "krill_probability", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_brief": { + "name": "krill_brief", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_model": { + "name": "krill_model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_channel_id": { + "name": "review_channel_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_status": { + "name": "delivery_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "previous_delivery_status": { + "name": "previous_delivery_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "card_revision": { + "name": "card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "synced_card_revision": { + "name": "synced_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "review_cases_case_id_unique": { + "name": "review_cases_case_id_unique", + "columns": [ + "case_id" + ], + "isUnique": true + }, + "idx_review_cases_guild_target": { + "name": "idx_review_cases_guild_target", + "columns": [ + "guild_id", + "target_user_id" + ], + "isUnique": false + }, + "idx_review_cases_status": { + "name": "idx_review_cases_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_review_cases_review_msg": { + "name": "idx_review_cases_review_msg", + "columns": [ + "review_message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_observations": { + "name": "review_observations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "author_id": { + "name": "author_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reply_to_id": { + "name": "reply_to_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content_length": { + "name": "content_length", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "line_count": { + "name": "line_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fingerprint": { + "name": "fingerprint", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artifacts": { + "name": "artifacts", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "similarity": { + "name": "similarity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "semantic_score": { + "name": "semantic_score", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "review_observations_message_id_unique": { + "name": "review_observations_message_id_unique", + "columns": [ + "message_id" + ], + "isUnique": true + }, + "idx_review_obs_guild_author": { + "name": "idx_review_obs_guild_author", + "columns": [ + "guild_id", + "author_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_author": { + "name": "idx_review_obs_author", + "columns": [ + "author_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_channel": { + "name": "idx_review_obs_channel", + "columns": [ + "channel_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_message": { + "name": "idx_review_obs_message", + "columns": [ + "message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "slap_events": { + "name": "slap_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_is_bot": { + "name": "target_is_bot", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "fish_slug": { + "name": "fish_slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fish_name": { + "name": "fish_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rarity": { + "name": "rarity", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "outcome": { + "name": "outcome", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headline": { + "name": "headline", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "narrative": { + "name": "narrative", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "impact": { + "name": "impact", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "dignity_remaining": { + "name": "dignity_remaining", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fish_condition": { + "name": "fish_condition", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "counter_actor_id": { + "name": "counter_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_target_id": { + "name": "counter_target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_slug": { + "name": "counter_fish_slug", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_name": { + "name": "counter_fish_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_rarity": { + "name": "counter_rarity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_outcome": { + "name": "counter_outcome", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_headline": { + "name": "counter_headline", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_narrative": { + "name": "counter_narrative", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_impact": { + "name": "counter_impact", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_dignity_remaining": { + "name": "counter_dignity_remaining", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_condition": { + "name": "counter_fish_condition", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_image_url": { + "name": "counter_image_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "countered_at": { + "name": "countered_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appealed_by_id": { + "name": "appealed_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appeal_ruling": { + "name": "appeal_ruling", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appealed_at": { + "name": "appealed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "slap_events_interaction_id_unique": { + "name": "slap_events_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "idx_slap_events_actor_cooldown": { + "name": "idx_slap_events_actor_cooldown", + "columns": [ + "guild_id", + "actor_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_target_cooldown": { + "name": "idx_slap_events_target_cooldown", + "columns": [ + "guild_id", + "target_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_channel_cooldown": { + "name": "idx_slap_events_channel_cooldown", + "columns": [ + "guild_id", + "channel_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_message": { + "name": "idx_slap_events_message", + "columns": [ + "guild_id", + "channel_id", + "message_id" + ], + "isUnique": false + }, + "idx_slap_events_outcome": { + "name": "idx_slap_events_outcome", + "columns": [ + "outcome" + ], + "isUnique": false + }, + "idx_slap_events_rarity": { + "name": "idx_slap_events_rarity", + "columns": [ + "rarity" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tracked_threads": { + "name": "tracked_threads", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_checked": { + "name": "last_checked", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "solved": { + "name": "solved", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "warning_level": { + "name": "warning_level", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "closed": { + "name": "closed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_message_count": { + "name": "last_message_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "tracked_threads_thread_id_unique": { + "name": "tracked_threads_thread_id_unique", + "columns": [ + "thread_id" + ], + "isUnique": true + }, + "idx_tracked_threads_solved": { + "name": "idx_tracked_threads_solved", + "columns": [ + "solved" + ], + "isUnique": false + }, + "idx_tracked_threads_last_checked": { + "name": "idx_tracked_threads_last_checked", + "columns": [ + "last_checked" + ], + "isUnique": false + }, + "idx_tracked_threads_received_at": { + "name": "idx_tracked_threads_received_at", + "columns": [ + "received_at" + ], + "isUnique": false + }, + "idx_tracked_threads_closed": { + "name": "idx_tracked_threads_closed", + "columns": [ + "closed" + ], + "isUnique": false + }, + "idx_tracked_threads_warning_level": { + "name": "idx_tracked_threads_warning_level", + "columns": [ + "warning_level" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/0014_snapshot.json b/drizzle/meta/0014_snapshot.json new file mode 100644 index 0000000..055e4ba --- /dev/null +++ b/drizzle/meta/0014_snapshot.json @@ -0,0 +1,2467 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "29547f05-acd2-4ad4-96e0-6ef525714164", + "prevId": "8c3f7a82-5471-4f0d-9035-fcbf634c3a6f", + "tables": { + "action_cooldown_events": { + "name": "action_cooldown_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action_kind": { + "name": "action_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor_expires_at": { + "name": "actor_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_expires_at": { + "name": "target_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_expires_at": { + "name": "channel_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "action_cooldown_events_interaction_id_unique": { + "name": "action_cooldown_events_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "idx_action_cooldowns_actor": { + "name": "idx_action_cooldowns_actor", + "columns": [ + "guild_id", + "actor_id", + "actor_expires_at" + ], + "isUnique": false + }, + "idx_action_cooldowns_target": { + "name": "idx_action_cooldowns_target", + "columns": [ + "guild_id", + "target_id", + "target_expires_at" + ], + "isUnique": false + }, + "idx_action_cooldowns_channel": { + "name": "idx_action_cooldowns_channel", + "columns": [ + "guild_id", + "channel_id", + "channel_expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "claim_requests": { + "name": "claim_requests", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "github_username": { + "name": "github_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "merged_pr_count": { + "name": "merged_pr_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_thread_id": { + "name": "review_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_at": { + "name": "decided_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_claim_requests_guild_user": { + "name": "idx_claim_requests_guild_user", + "columns": [ + "guild_id", + "user_id" + ], + "isUnique": true + }, + "idx_claim_requests_user_id": { + "name": "idx_claim_requests_user_id", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "idx_claim_requests_status": { + "name": "idx_claim_requests_status", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_cases": { + "name": "clawhub_content_rights_cases", + "columns": { + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "form_submission_id": { + "name": "form_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "requester_name": { + "name": "requester_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organization": { + "name": "organization", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "clawhub_urls": { + "name": "clawhub_urls", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "explanation": { + "name": "explanation", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "clawhub_content_rights_cases_form_submission_id_unique": { + "name": "clawhub_content_rights_cases_form_submission_id_unique", + "columns": [ + "form_submission_id" + ], + "isUnique": true + }, + "idx_clawhub_content_rights_cases_status": { + "name": "idx_clawhub_content_rights_cases_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_clawhub_content_rights_cases_email": { + "name": "idx_clawhub_content_rights_cases_email", + "columns": [ + "email" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_events": { + "name": "clawhub_content_rights_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor": { + "name": "actor", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_clawhub_content_rights_events_case_id": { + "name": "idx_clawhub_content_rights_events_case_id", + "columns": [ + "case_id" + ], + "isUnique": false + }, + "idx_clawhub_content_rights_events_event_type": { + "name": "idx_clawhub_content_rights_events_event_type", + "columns": [ + "event_type" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_files": { + "name": "clawhub_content_rights_files", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "object_key": { + "name": "object_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_name": { + "name": "original_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "size_bytes": { + "name": "size_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "clawhub_content_rights_files_object_key_unique": { + "name": "clawhub_content_rights_files_object_key_unique", + "columns": [ + "object_key" + ], + "isUnique": true + }, + "idx_clawhub_content_rights_files_case_id": { + "name": "idx_clawhub_content_rights_files_case_id", + "columns": [ + "case_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "form_submissions": { + "name": "form_submissions", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "form_id": { + "name": "form_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "auth_provider": { + "name": "auth_provider", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applicant_id": { + "name": "applicant_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applicant_username": { + "name": "applicant_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_channel_id": { + "name": "review_channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_thread_id": { + "name": "review_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_at": { + "name": "decided_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "action_result": { + "name": "action_result", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_form_submissions_form_id": { + "name": "idx_form_submissions_form_id", + "columns": [ + "form_id" + ], + "isUnique": false + }, + "idx_form_submissions_status": { + "name": "idx_form_submissions_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_form_submissions_applicant_id": { + "name": "idx_form_submissions_applicant_id", + "columns": [ + "applicant_id" + ], + "isUnique": false + }, + "idx_form_submissions_review_message_id": { + "name": "idx_form_submissions_review_message_id", + "columns": [ + "review_message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "helper_events": { + "name": "helper_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'helper_command'" + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message_count": { + "name": "message_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "event_time": { + "name": "event_time", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "command": { + "name": "command", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "invoked_by_id": { + "name": "invoked_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoked_by_username": { + "name": "invoked_by_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoked_by_global_name": { + "name": "invoked_by_global_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_helper_events_event_time": { + "name": "idx_helper_events_event_time", + "columns": [ + "event_time" + ], + "isUnique": false + }, + "idx_helper_events_command": { + "name": "idx_helper_events_command", + "columns": [ + "command" + ], + "isUnique": false + }, + "idx_helper_events_thread_id": { + "name": "idx_helper_events_thread_id", + "columns": [ + "thread_id" + ], + "isUnique": false + }, + "idx_helper_events_invoked_by_id": { + "name": "idx_helper_events_invoked_by_id", + "columns": [ + "invoked_by_id" + ], + "isUnique": false + }, + "idx_helper_events_event_type": { + "name": "idx_helper_events_event_type", + "columns": [ + "event_type" + ], + "isUnique": false + }, + "idx_helper_events_thread_time": { + "name": "idx_helper_events_thread_time", + "columns": [ + "thread_id", + "event_time" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "keyValue": { + "name": "keyValue", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "lobster_encounters": { + "name": "lobster_encounters", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cooldown_event_id": { + "name": "cooldown_event_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_is_bot": { + "name": "target_is_bot", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "taxonomy_snapshot_id": { + "name": "taxonomy_snapshot_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_aphia_id": { + "name": "species_aphia_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_accepted_name": { + "name": "species_accepted_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_display_name": { + "name": "species_display_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_family": { + "name": "species_family", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scene_id": { + "name": "scene_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_url": { + "name": "asset_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_checksum": { + "name": "asset_checksum", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headline": { + "name": "headline", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "narrative": { + "name": "narrative", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metrics_json": { + "name": "metrics_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accessibility_description": { + "name": "accessibility_description", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "publication_status": { + "name": "publication_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "publication_failure": { + "name": "publication_failure", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "publication_failed_at": { + "name": "publication_failed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message_bound_at": { + "name": "message_bound_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_status": { + "name": "response_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "response_type": { + "name": "response_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_actor_id": { + "name": "response_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "responded_at": { + "name": "responded_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_result_json": { + "name": "response_result_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_actor_id": { + "name": "counter_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_target_id": { + "name": "counter_target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_scene_id": { + "name": "counter_scene_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_asset_url": { + "name": "counter_asset_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_asset_checksum": { + "name": "counter_asset_checksum", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_headline": { + "name": "counter_headline", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_narrative": { + "name": "counter_narrative", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_metrics_json": { + "name": "counter_metrics_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_accessibility_description": { + "name": "counter_accessibility_description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "lobster_encounters_interaction_id_unique": { + "name": "lobster_encounters_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "lobster_encounters_cooldown_event_id_unique": { + "name": "lobster_encounters_cooldown_event_id_unique", + "columns": [ + "cooldown_event_id" + ], + "isUnique": true + }, + "idx_lobster_encounters_message": { + "name": "idx_lobster_encounters_message", + "columns": [ + "guild_id", + "channel_id", + "message_id" + ], + "isUnique": false + }, + "idx_lobster_encounters_species": { + "name": "idx_lobster_encounters_species", + "columns": [ + "species_aphia_id" + ], + "isUnique": false + }, + "idx_lobster_encounters_publication": { + "name": "idx_lobster_encounters_publication", + "columns": [ + "publication_status" + ], + "isUnique": false + }, + "idx_lobster_encounters_response": { + "name": "idx_lobster_encounters_response", + "columns": [ + "response_status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "nomination_approvals": { + "name": "nomination_approvals", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "nomination_id": { + "name": "nomination_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "approver_id": { + "name": "approver_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "vote_choice": { + "name": "vote_choice", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'approve'" + }, + "mutation_id": { + "name": "mutation_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_nomination_approvals_nomination_approver": { + "name": "idx_nomination_approvals_nomination_approver", + "columns": [ + "nomination_id", + "approver_id" + ], + "isUnique": true + }, + "idx_nomination_approvals_nomination_id": { + "name": "idx_nomination_approvals_nomination_id", + "columns": [ + "nomination_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "nominations": { + "name": "nominations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nominee_id": { + "name": "nominee_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nominator_id": { + "name": "nominator_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'No reason provided.'" + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_role_id": { + "name": "target_role_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "required_approvals": { + "name": "required_approvals", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "completed_at": { + "name": "completed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "desired_card_revision": { + "name": "desired_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "synced_card_revision": { + "name": "synced_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "card_sync_started_at": { + "name": "card_sync_started_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_sync_failure_count": { + "name": "card_sync_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "grant_started_at": { + "name": "grant_started_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "grant_failure_count": { + "name": "grant_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_nominations_active_unique": { + "name": "idx_nominations_active_unique", + "columns": [ + "guild_id", + "nominee_id", + "target_role_id" + ], + "isUnique": true, + "where": "\"nominations\".\"status\" in ('submitted', 'granting')" + }, + "idx_nominations_status": { + "name": "idx_nominations_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_nominations_card_sync": { + "name": "idx_nominations_card_sync", + "columns": [ + "desired_card_revision", + "synced_card_revision" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "reddit_moderation_contexts": { + "name": "reddit_moderation_contexts", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "subreddit": { + "name": "subreddit", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'moderated'" + }, + "unaction": { + "name": "unaction", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'reviewed'" + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "moderator": { + "name": "moderator", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banned_at": { + "name": "banned_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_reddit_moderation_contexts_subreddit_username": { + "name": "idx_reddit_moderation_contexts_subreddit_username", + "columns": [ + "subreddit", + "username" + ], + "isUnique": true + }, + "idx_reddit_moderation_contexts_username": { + "name": "idx_reddit_moderation_contexts_username", + "columns": [ + "username" + ], + "isUnique": false + }, + "idx_reddit_moderation_contexts_action": { + "name": "idx_reddit_moderation_contexts_action", + "columns": [ + "action" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_cases": { + "name": "review_cases", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_user_id": { + "name": "target_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'open'" + }, + "heuristic_score": { + "name": "heuristic_score", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "concordance": { + "name": "concordance", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "behavioral_families": { + "name": "behavioral_families", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "evidence_message_id": { + "name": "evidence_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_probability": { + "name": "krill_probability", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_brief": { + "name": "krill_brief", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_model": { + "name": "krill_model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_channel_id": { + "name": "review_channel_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_status": { + "name": "delivery_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "previous_delivery_status": { + "name": "previous_delivery_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "delivery_nonce": { + "name": "delivery_nonce", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_claim_token": { + "name": "delivery_claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_claim_expires_at": { + "name": "delivery_claim_expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_claim_token": { + "name": "receipt_claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_claim_expires_at": { + "name": "receipt_claim_expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_next_attempt_at": { + "name": "receipt_next_attempt_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_history_before": { + "name": "receipt_history_before", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_revision": { + "name": "card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "synced_card_revision": { + "name": "synced_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "card_sync_next_attempt_at": { + "name": "card_sync_next_attempt_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_sync_failure_count": { + "name": "card_sync_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "review_cases_case_id_unique": { + "name": "review_cases_case_id_unique", + "columns": [ + "case_id" + ], + "isUnique": true + }, + "idx_review_cases_guild_target": { + "name": "idx_review_cases_guild_target", + "columns": [ + "guild_id", + "target_user_id" + ], + "isUnique": false + }, + "idx_review_cases_status": { + "name": "idx_review_cases_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_review_cases_review_msg": { + "name": "idx_review_cases_review_msg", + "columns": [ + "review_message_id" + ], + "isUnique": false + }, + "idx_review_cases_receipt_recovery": { + "name": "idx_review_cases_receipt_recovery", + "columns": [ + "guild_id", + "delivery_status", + "receipt_next_attempt_at", + "receipt_claim_expires_at" + ], + "isUnique": false + }, + "idx_review_cases_card_sync_due": { + "name": "idx_review_cases_card_sync_due", + "columns": [ + "card_sync_next_attempt_at", + "card_revision", + "synced_card_revision" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_observations": { + "name": "review_observations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "author_id": { + "name": "author_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reply_to_id": { + "name": "reply_to_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content_length": { + "name": "content_length", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "line_count": { + "name": "line_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fingerprint": { + "name": "fingerprint", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artifacts": { + "name": "artifacts", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "similarity": { + "name": "similarity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "semantic_score": { + "name": "semantic_score", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "review_observations_message_id_unique": { + "name": "review_observations_message_id_unique", + "columns": [ + "message_id" + ], + "isUnique": true + }, + "idx_review_obs_guild_author": { + "name": "idx_review_obs_guild_author", + "columns": [ + "guild_id", + "author_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_author": { + "name": "idx_review_obs_author", + "columns": [ + "author_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_channel": { + "name": "idx_review_obs_channel", + "columns": [ + "channel_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_message": { + "name": "idx_review_obs_message", + "columns": [ + "message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "slap_events": { + "name": "slap_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_is_bot": { + "name": "target_is_bot", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "fish_slug": { + "name": "fish_slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fish_name": { + "name": "fish_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rarity": { + "name": "rarity", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "outcome": { + "name": "outcome", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headline": { + "name": "headline", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "narrative": { + "name": "narrative", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "impact": { + "name": "impact", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "dignity_remaining": { + "name": "dignity_remaining", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fish_condition": { + "name": "fish_condition", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "counter_actor_id": { + "name": "counter_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_target_id": { + "name": "counter_target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_slug": { + "name": "counter_fish_slug", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_name": { + "name": "counter_fish_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_rarity": { + "name": "counter_rarity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_outcome": { + "name": "counter_outcome", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_headline": { + "name": "counter_headline", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_narrative": { + "name": "counter_narrative", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_impact": { + "name": "counter_impact", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_dignity_remaining": { + "name": "counter_dignity_remaining", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_condition": { + "name": "counter_fish_condition", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_image_url": { + "name": "counter_image_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "countered_at": { + "name": "countered_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appealed_by_id": { + "name": "appealed_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appeal_ruling": { + "name": "appeal_ruling", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appealed_at": { + "name": "appealed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "slap_events_interaction_id_unique": { + "name": "slap_events_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "idx_slap_events_actor_cooldown": { + "name": "idx_slap_events_actor_cooldown", + "columns": [ + "guild_id", + "actor_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_target_cooldown": { + "name": "idx_slap_events_target_cooldown", + "columns": [ + "guild_id", + "target_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_channel_cooldown": { + "name": "idx_slap_events_channel_cooldown", + "columns": [ + "guild_id", + "channel_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_message": { + "name": "idx_slap_events_message", + "columns": [ + "guild_id", + "channel_id", + "message_id" + ], + "isUnique": false + }, + "idx_slap_events_outcome": { + "name": "idx_slap_events_outcome", + "columns": [ + "outcome" + ], + "isUnique": false + }, + "idx_slap_events_rarity": { + "name": "idx_slap_events_rarity", + "columns": [ + "rarity" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tracked_threads": { + "name": "tracked_threads", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_checked": { + "name": "last_checked", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "solved": { + "name": "solved", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "warning_level": { + "name": "warning_level", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "closed": { + "name": "closed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_message_count": { + "name": "last_message_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "tracked_threads_thread_id_unique": { + "name": "tracked_threads_thread_id_unique", + "columns": [ + "thread_id" + ], + "isUnique": true + }, + "idx_tracked_threads_solved": { + "name": "idx_tracked_threads_solved", + "columns": [ + "solved" + ], + "isUnique": false + }, + "idx_tracked_threads_last_checked": { + "name": "idx_tracked_threads_last_checked", + "columns": [ + "last_checked" + ], + "isUnique": false + }, + "idx_tracked_threads_received_at": { + "name": "idx_tracked_threads_received_at", + "columns": [ + "received_at" + ], + "isUnique": false + }, + "idx_tracked_threads_closed": { + "name": "idx_tracked_threads_closed", + "columns": [ + "closed" + ], + "isUnique": false + }, + "idx_tracked_threads_warning_level": { + "name": "idx_tracked_threads_warning_level", + "columns": [ + "warning_level" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/0015_snapshot.json b/drizzle/meta/0015_snapshot.json new file mode 100644 index 0000000..55b6059 --- /dev/null +++ b/drizzle/meta/0015_snapshot.json @@ -0,0 +1,2481 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "567da316-0d3b-4134-ac9a-d743cb3da55b", + "prevId": "29547f05-acd2-4ad4-96e0-6ef525714164", + "tables": { + "action_cooldown_events": { + "name": "action_cooldown_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action_kind": { + "name": "action_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor_expires_at": { + "name": "actor_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_expires_at": { + "name": "target_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_expires_at": { + "name": "channel_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "action_cooldown_events_interaction_id_unique": { + "name": "action_cooldown_events_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "idx_action_cooldowns_actor": { + "name": "idx_action_cooldowns_actor", + "columns": [ + "guild_id", + "actor_id", + "actor_expires_at" + ], + "isUnique": false + }, + "idx_action_cooldowns_target": { + "name": "idx_action_cooldowns_target", + "columns": [ + "guild_id", + "target_id", + "target_expires_at" + ], + "isUnique": false + }, + "idx_action_cooldowns_channel": { + "name": "idx_action_cooldowns_channel", + "columns": [ + "guild_id", + "channel_id", + "channel_expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "claim_requests": { + "name": "claim_requests", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "github_username": { + "name": "github_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "merged_pr_count": { + "name": "merged_pr_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_thread_id": { + "name": "review_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_at": { + "name": "decided_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_claim_requests_guild_user": { + "name": "idx_claim_requests_guild_user", + "columns": [ + "guild_id", + "user_id" + ], + "isUnique": true + }, + "idx_claim_requests_user_id": { + "name": "idx_claim_requests_user_id", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "idx_claim_requests_status": { + "name": "idx_claim_requests_status", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_cases": { + "name": "clawhub_content_rights_cases", + "columns": { + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "form_submission_id": { + "name": "form_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "requester_name": { + "name": "requester_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organization": { + "name": "organization", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "clawhub_urls": { + "name": "clawhub_urls", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "explanation": { + "name": "explanation", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "clawhub_content_rights_cases_form_submission_id_unique": { + "name": "clawhub_content_rights_cases_form_submission_id_unique", + "columns": [ + "form_submission_id" + ], + "isUnique": true + }, + "idx_clawhub_content_rights_cases_status": { + "name": "idx_clawhub_content_rights_cases_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_clawhub_content_rights_cases_email": { + "name": "idx_clawhub_content_rights_cases_email", + "columns": [ + "email" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_events": { + "name": "clawhub_content_rights_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor": { + "name": "actor", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_clawhub_content_rights_events_case_id": { + "name": "idx_clawhub_content_rights_events_case_id", + "columns": [ + "case_id" + ], + "isUnique": false + }, + "idx_clawhub_content_rights_events_event_type": { + "name": "idx_clawhub_content_rights_events_event_type", + "columns": [ + "event_type" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_files": { + "name": "clawhub_content_rights_files", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "object_key": { + "name": "object_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_name": { + "name": "original_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "size_bytes": { + "name": "size_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "clawhub_content_rights_files_object_key_unique": { + "name": "clawhub_content_rights_files_object_key_unique", + "columns": [ + "object_key" + ], + "isUnique": true + }, + "idx_clawhub_content_rights_files_case_id": { + "name": "idx_clawhub_content_rights_files_case_id", + "columns": [ + "case_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "form_submissions": { + "name": "form_submissions", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "form_id": { + "name": "form_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "auth_provider": { + "name": "auth_provider", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applicant_id": { + "name": "applicant_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applicant_username": { + "name": "applicant_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_channel_id": { + "name": "review_channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_thread_id": { + "name": "review_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_at": { + "name": "decided_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "action_result": { + "name": "action_result", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_form_submissions_form_id": { + "name": "idx_form_submissions_form_id", + "columns": [ + "form_id" + ], + "isUnique": false + }, + "idx_form_submissions_status": { + "name": "idx_form_submissions_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_form_submissions_applicant_id": { + "name": "idx_form_submissions_applicant_id", + "columns": [ + "applicant_id" + ], + "isUnique": false + }, + "idx_form_submissions_review_message_id": { + "name": "idx_form_submissions_review_message_id", + "columns": [ + "review_message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "helper_events": { + "name": "helper_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'helper_command'" + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message_count": { + "name": "message_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "event_time": { + "name": "event_time", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "command": { + "name": "command", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "invoked_by_id": { + "name": "invoked_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoked_by_username": { + "name": "invoked_by_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoked_by_global_name": { + "name": "invoked_by_global_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_helper_events_event_time": { + "name": "idx_helper_events_event_time", + "columns": [ + "event_time" + ], + "isUnique": false + }, + "idx_helper_events_command": { + "name": "idx_helper_events_command", + "columns": [ + "command" + ], + "isUnique": false + }, + "idx_helper_events_thread_id": { + "name": "idx_helper_events_thread_id", + "columns": [ + "thread_id" + ], + "isUnique": false + }, + "idx_helper_events_invoked_by_id": { + "name": "idx_helper_events_invoked_by_id", + "columns": [ + "invoked_by_id" + ], + "isUnique": false + }, + "idx_helper_events_event_type": { + "name": "idx_helper_events_event_type", + "columns": [ + "event_type" + ], + "isUnique": false + }, + "idx_helper_events_thread_time": { + "name": "idx_helper_events_thread_time", + "columns": [ + "thread_id", + "event_time" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "keyValue": { + "name": "keyValue", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "lobster_encounters": { + "name": "lobster_encounters", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cooldown_event_id": { + "name": "cooldown_event_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_is_bot": { + "name": "target_is_bot", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "taxonomy_snapshot_id": { + "name": "taxonomy_snapshot_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_aphia_id": { + "name": "species_aphia_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_accepted_name": { + "name": "species_accepted_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_display_name": { + "name": "species_display_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_family": { + "name": "species_family", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scene_id": { + "name": "scene_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_url": { + "name": "asset_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_checksum": { + "name": "asset_checksum", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headline": { + "name": "headline", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "narrative": { + "name": "narrative", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metrics_json": { + "name": "metrics_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accessibility_description": { + "name": "accessibility_description", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "publication_status": { + "name": "publication_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "publication_failure": { + "name": "publication_failure", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "publication_failed_at": { + "name": "publication_failed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message_bound_at": { + "name": "message_bound_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_status": { + "name": "response_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "response_type": { + "name": "response_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_actor_id": { + "name": "response_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "responded_at": { + "name": "responded_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_result_json": { + "name": "response_result_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_actor_id": { + "name": "counter_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_target_id": { + "name": "counter_target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_scene_id": { + "name": "counter_scene_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_asset_url": { + "name": "counter_asset_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_asset_checksum": { + "name": "counter_asset_checksum", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_headline": { + "name": "counter_headline", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_narrative": { + "name": "counter_narrative", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_metrics_json": { + "name": "counter_metrics_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_accessibility_description": { + "name": "counter_accessibility_description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "lobster_encounters_interaction_id_unique": { + "name": "lobster_encounters_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "lobster_encounters_cooldown_event_id_unique": { + "name": "lobster_encounters_cooldown_event_id_unique", + "columns": [ + "cooldown_event_id" + ], + "isUnique": true + }, + "idx_lobster_encounters_message": { + "name": "idx_lobster_encounters_message", + "columns": [ + "guild_id", + "channel_id", + "message_id" + ], + "isUnique": false + }, + "idx_lobster_encounters_species": { + "name": "idx_lobster_encounters_species", + "columns": [ + "species_aphia_id" + ], + "isUnique": false + }, + "idx_lobster_encounters_publication": { + "name": "idx_lobster_encounters_publication", + "columns": [ + "publication_status" + ], + "isUnique": false + }, + "idx_lobster_encounters_response": { + "name": "idx_lobster_encounters_response", + "columns": [ + "response_status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "nomination_approvals": { + "name": "nomination_approvals", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "nomination_id": { + "name": "nomination_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "approver_id": { + "name": "approver_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "vote_choice": { + "name": "vote_choice", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'approve'" + }, + "mutation_id": { + "name": "mutation_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_nomination_approvals_nomination_approver": { + "name": "idx_nomination_approvals_nomination_approver", + "columns": [ + "nomination_id", + "approver_id" + ], + "isUnique": true + }, + "idx_nomination_approvals_nomination_id": { + "name": "idx_nomination_approvals_nomination_id", + "columns": [ + "nomination_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "nominations": { + "name": "nominations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nominee_id": { + "name": "nominee_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nominator_id": { + "name": "nominator_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'No reason provided.'" + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_role_id": { + "name": "target_role_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "required_approvals": { + "name": "required_approvals", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "completed_at": { + "name": "completed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "desired_card_revision": { + "name": "desired_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "synced_card_revision": { + "name": "synced_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "card_sync_started_at": { + "name": "card_sync_started_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_sync_failure_count": { + "name": "card_sync_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "grant_started_at": { + "name": "grant_started_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "grant_failure_count": { + "name": "grant_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_nominations_active_unique": { + "name": "idx_nominations_active_unique", + "columns": [ + "guild_id", + "nominee_id", + "target_role_id" + ], + "isUnique": true, + "where": "\"nominations\".\"status\" in ('submitted', 'granting')" + }, + "idx_nominations_status": { + "name": "idx_nominations_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_nominations_card_sync": { + "name": "idx_nominations_card_sync", + "columns": [ + "desired_card_revision", + "synced_card_revision" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "reddit_moderation_contexts": { + "name": "reddit_moderation_contexts", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "subreddit": { + "name": "subreddit", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'moderated'" + }, + "unaction": { + "name": "unaction", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'reviewed'" + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "moderator": { + "name": "moderator", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banned_at": { + "name": "banned_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_reddit_moderation_contexts_subreddit_username": { + "name": "idx_reddit_moderation_contexts_subreddit_username", + "columns": [ + "subreddit", + "username" + ], + "isUnique": true + }, + "idx_reddit_moderation_contexts_username": { + "name": "idx_reddit_moderation_contexts_username", + "columns": [ + "username" + ], + "isUnique": false + }, + "idx_reddit_moderation_contexts_action": { + "name": "idx_reddit_moderation_contexts_action", + "columns": [ + "action" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_cases": { + "name": "review_cases", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_user_id": { + "name": "target_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'open'" + }, + "heuristic_score": { + "name": "heuristic_score", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "concordance": { + "name": "concordance", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "behavioral_families": { + "name": "behavioral_families", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "evidence_message_id": { + "name": "evidence_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_probability": { + "name": "krill_probability", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_brief": { + "name": "krill_brief", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_model": { + "name": "krill_model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_channel_id": { + "name": "review_channel_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_status": { + "name": "delivery_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "previous_delivery_status": { + "name": "previous_delivery_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "delivery_nonce": { + "name": "delivery_nonce", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_preflight_completed_at": { + "name": "delivery_preflight_completed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_post_attempted_at": { + "name": "delivery_post_attempted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_claim_token": { + "name": "delivery_claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_claim_expires_at": { + "name": "delivery_claim_expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_claim_token": { + "name": "receipt_claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_claim_expires_at": { + "name": "receipt_claim_expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_next_attempt_at": { + "name": "receipt_next_attempt_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_history_before": { + "name": "receipt_history_before", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_revision": { + "name": "card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "synced_card_revision": { + "name": "synced_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "card_sync_next_attempt_at": { + "name": "card_sync_next_attempt_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_sync_failure_count": { + "name": "card_sync_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "review_cases_case_id_unique": { + "name": "review_cases_case_id_unique", + "columns": [ + "case_id" + ], + "isUnique": true + }, + "idx_review_cases_guild_target": { + "name": "idx_review_cases_guild_target", + "columns": [ + "guild_id", + "target_user_id" + ], + "isUnique": false + }, + "idx_review_cases_status": { + "name": "idx_review_cases_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_review_cases_review_msg": { + "name": "idx_review_cases_review_msg", + "columns": [ + "review_message_id" + ], + "isUnique": false + }, + "idx_review_cases_receipt_recovery": { + "name": "idx_review_cases_receipt_recovery", + "columns": [ + "guild_id", + "delivery_status", + "receipt_next_attempt_at", + "receipt_claim_expires_at" + ], + "isUnique": false + }, + "idx_review_cases_card_sync_due": { + "name": "idx_review_cases_card_sync_due", + "columns": [ + "card_sync_next_attempt_at", + "card_revision", + "synced_card_revision" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_observations": { + "name": "review_observations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "author_id": { + "name": "author_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reply_to_id": { + "name": "reply_to_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content_length": { + "name": "content_length", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "line_count": { + "name": "line_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fingerprint": { + "name": "fingerprint", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artifacts": { + "name": "artifacts", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "similarity": { + "name": "similarity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "semantic_score": { + "name": "semantic_score", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "review_observations_message_id_unique": { + "name": "review_observations_message_id_unique", + "columns": [ + "message_id" + ], + "isUnique": true + }, + "idx_review_obs_guild_author": { + "name": "idx_review_obs_guild_author", + "columns": [ + "guild_id", + "author_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_author": { + "name": "idx_review_obs_author", + "columns": [ + "author_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_channel": { + "name": "idx_review_obs_channel", + "columns": [ + "channel_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_message": { + "name": "idx_review_obs_message", + "columns": [ + "message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "slap_events": { + "name": "slap_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_is_bot": { + "name": "target_is_bot", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "fish_slug": { + "name": "fish_slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fish_name": { + "name": "fish_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rarity": { + "name": "rarity", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "outcome": { + "name": "outcome", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headline": { + "name": "headline", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "narrative": { + "name": "narrative", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "impact": { + "name": "impact", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "dignity_remaining": { + "name": "dignity_remaining", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fish_condition": { + "name": "fish_condition", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "counter_actor_id": { + "name": "counter_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_target_id": { + "name": "counter_target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_slug": { + "name": "counter_fish_slug", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_name": { + "name": "counter_fish_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_rarity": { + "name": "counter_rarity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_outcome": { + "name": "counter_outcome", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_headline": { + "name": "counter_headline", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_narrative": { + "name": "counter_narrative", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_impact": { + "name": "counter_impact", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_dignity_remaining": { + "name": "counter_dignity_remaining", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_condition": { + "name": "counter_fish_condition", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_image_url": { + "name": "counter_image_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "countered_at": { + "name": "countered_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appealed_by_id": { + "name": "appealed_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appeal_ruling": { + "name": "appeal_ruling", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appealed_at": { + "name": "appealed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "slap_events_interaction_id_unique": { + "name": "slap_events_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "idx_slap_events_actor_cooldown": { + "name": "idx_slap_events_actor_cooldown", + "columns": [ + "guild_id", + "actor_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_target_cooldown": { + "name": "idx_slap_events_target_cooldown", + "columns": [ + "guild_id", + "target_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_channel_cooldown": { + "name": "idx_slap_events_channel_cooldown", + "columns": [ + "guild_id", + "channel_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_message": { + "name": "idx_slap_events_message", + "columns": [ + "guild_id", + "channel_id", + "message_id" + ], + "isUnique": false + }, + "idx_slap_events_outcome": { + "name": "idx_slap_events_outcome", + "columns": [ + "outcome" + ], + "isUnique": false + }, + "idx_slap_events_rarity": { + "name": "idx_slap_events_rarity", + "columns": [ + "rarity" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tracked_threads": { + "name": "tracked_threads", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_checked": { + "name": "last_checked", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "solved": { + "name": "solved", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "warning_level": { + "name": "warning_level", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "closed": { + "name": "closed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_message_count": { + "name": "last_message_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "tracked_threads_thread_id_unique": { + "name": "tracked_threads_thread_id_unique", + "columns": [ + "thread_id" + ], + "isUnique": true + }, + "idx_tracked_threads_solved": { + "name": "idx_tracked_threads_solved", + "columns": [ + "solved" + ], + "isUnique": false + }, + "idx_tracked_threads_last_checked": { + "name": "idx_tracked_threads_last_checked", + "columns": [ + "last_checked" + ], + "isUnique": false + }, + "idx_tracked_threads_received_at": { + "name": "idx_tracked_threads_received_at", + "columns": [ + "received_at" + ], + "isUnique": false + }, + "idx_tracked_threads_closed": { + "name": "idx_tracked_threads_closed", + "columns": [ + "closed" + ], + "isUnique": false + }, + "idx_tracked_threads_warning_level": { + "name": "idx_tracked_threads_warning_level", + "columns": [ + "warning_level" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/0016_snapshot.json b/drizzle/meta/0016_snapshot.json new file mode 100644 index 0000000..a77fe4b --- /dev/null +++ b/drizzle/meta/0016_snapshot.json @@ -0,0 +1,2489 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "7498e5bb-f7e3-410c-bdd8-2b76656dde5c", + "prevId": "567da316-0d3b-4134-ac9a-d743cb3da55b", + "tables": { + "action_cooldown_events": { + "name": "action_cooldown_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action_kind": { + "name": "action_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor_expires_at": { + "name": "actor_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_expires_at": { + "name": "target_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_expires_at": { + "name": "channel_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "action_cooldown_events_interaction_id_unique": { + "name": "action_cooldown_events_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "idx_action_cooldowns_actor": { + "name": "idx_action_cooldowns_actor", + "columns": [ + "guild_id", + "actor_id", + "actor_expires_at" + ], + "isUnique": false + }, + "idx_action_cooldowns_target": { + "name": "idx_action_cooldowns_target", + "columns": [ + "guild_id", + "target_id", + "target_expires_at" + ], + "isUnique": false + }, + "idx_action_cooldowns_channel": { + "name": "idx_action_cooldowns_channel", + "columns": [ + "guild_id", + "channel_id", + "channel_expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "claim_requests": { + "name": "claim_requests", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "github_username": { + "name": "github_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "merged_pr_count": { + "name": "merged_pr_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_thread_id": { + "name": "review_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_at": { + "name": "decided_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_claim_requests_guild_user": { + "name": "idx_claim_requests_guild_user", + "columns": [ + "guild_id", + "user_id" + ], + "isUnique": true + }, + "idx_claim_requests_user_id": { + "name": "idx_claim_requests_user_id", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "idx_claim_requests_status": { + "name": "idx_claim_requests_status", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_cases": { + "name": "clawhub_content_rights_cases", + "columns": { + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "form_submission_id": { + "name": "form_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "requester_name": { + "name": "requester_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organization": { + "name": "organization", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "clawhub_urls": { + "name": "clawhub_urls", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "explanation": { + "name": "explanation", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "clawhub_content_rights_cases_form_submission_id_unique": { + "name": "clawhub_content_rights_cases_form_submission_id_unique", + "columns": [ + "form_submission_id" + ], + "isUnique": true + }, + "idx_clawhub_content_rights_cases_status": { + "name": "idx_clawhub_content_rights_cases_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_clawhub_content_rights_cases_email": { + "name": "idx_clawhub_content_rights_cases_email", + "columns": [ + "email" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_events": { + "name": "clawhub_content_rights_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor": { + "name": "actor", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_clawhub_content_rights_events_case_id": { + "name": "idx_clawhub_content_rights_events_case_id", + "columns": [ + "case_id" + ], + "isUnique": false + }, + "idx_clawhub_content_rights_events_event_type": { + "name": "idx_clawhub_content_rights_events_event_type", + "columns": [ + "event_type" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_files": { + "name": "clawhub_content_rights_files", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "object_key": { + "name": "object_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_name": { + "name": "original_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "size_bytes": { + "name": "size_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "clawhub_content_rights_files_object_key_unique": { + "name": "clawhub_content_rights_files_object_key_unique", + "columns": [ + "object_key" + ], + "isUnique": true + }, + "idx_clawhub_content_rights_files_case_id": { + "name": "idx_clawhub_content_rights_files_case_id", + "columns": [ + "case_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "form_submissions": { + "name": "form_submissions", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "form_id": { + "name": "form_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "auth_provider": { + "name": "auth_provider", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applicant_id": { + "name": "applicant_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applicant_username": { + "name": "applicant_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_channel_id": { + "name": "review_channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_thread_id": { + "name": "review_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_at": { + "name": "decided_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "action_result": { + "name": "action_result", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_form_submissions_form_id": { + "name": "idx_form_submissions_form_id", + "columns": [ + "form_id" + ], + "isUnique": false + }, + "idx_form_submissions_status": { + "name": "idx_form_submissions_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_form_submissions_applicant_id": { + "name": "idx_form_submissions_applicant_id", + "columns": [ + "applicant_id" + ], + "isUnique": false + }, + "idx_form_submissions_review_message_id": { + "name": "idx_form_submissions_review_message_id", + "columns": [ + "review_message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "helper_events": { + "name": "helper_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'helper_command'" + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message_count": { + "name": "message_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "event_time": { + "name": "event_time", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "command": { + "name": "command", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "invoked_by_id": { + "name": "invoked_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoked_by_username": { + "name": "invoked_by_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoked_by_global_name": { + "name": "invoked_by_global_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_helper_events_event_time": { + "name": "idx_helper_events_event_time", + "columns": [ + "event_time" + ], + "isUnique": false + }, + "idx_helper_events_command": { + "name": "idx_helper_events_command", + "columns": [ + "command" + ], + "isUnique": false + }, + "idx_helper_events_thread_id": { + "name": "idx_helper_events_thread_id", + "columns": [ + "thread_id" + ], + "isUnique": false + }, + "idx_helper_events_invoked_by_id": { + "name": "idx_helper_events_invoked_by_id", + "columns": [ + "invoked_by_id" + ], + "isUnique": false + }, + "idx_helper_events_event_type": { + "name": "idx_helper_events_event_type", + "columns": [ + "event_type" + ], + "isUnique": false + }, + "idx_helper_events_thread_time": { + "name": "idx_helper_events_thread_time", + "columns": [ + "thread_id", + "event_time" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "keyValue": { + "name": "keyValue", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "lobster_encounters": { + "name": "lobster_encounters", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cooldown_event_id": { + "name": "cooldown_event_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_is_bot": { + "name": "target_is_bot", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "taxonomy_snapshot_id": { + "name": "taxonomy_snapshot_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_aphia_id": { + "name": "species_aphia_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_accepted_name": { + "name": "species_accepted_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_display_name": { + "name": "species_display_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_family": { + "name": "species_family", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scene_id": { + "name": "scene_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_url": { + "name": "asset_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_checksum": { + "name": "asset_checksum", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headline": { + "name": "headline", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "narrative": { + "name": "narrative", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metrics_json": { + "name": "metrics_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accessibility_description": { + "name": "accessibility_description", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "publication_status": { + "name": "publication_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "publication_failure": { + "name": "publication_failure", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "publication_failed_at": { + "name": "publication_failed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message_bound_at": { + "name": "message_bound_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_status": { + "name": "response_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "response_type": { + "name": "response_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_actor_id": { + "name": "response_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "responded_at": { + "name": "responded_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_result_json": { + "name": "response_result_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_actor_id": { + "name": "counter_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_target_id": { + "name": "counter_target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_scene_id": { + "name": "counter_scene_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_asset_url": { + "name": "counter_asset_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_asset_checksum": { + "name": "counter_asset_checksum", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_headline": { + "name": "counter_headline", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_narrative": { + "name": "counter_narrative", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_metrics_json": { + "name": "counter_metrics_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_accessibility_description": { + "name": "counter_accessibility_description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "lobster_encounters_interaction_id_unique": { + "name": "lobster_encounters_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "lobster_encounters_cooldown_event_id_unique": { + "name": "lobster_encounters_cooldown_event_id_unique", + "columns": [ + "cooldown_event_id" + ], + "isUnique": true + }, + "idx_lobster_encounters_message": { + "name": "idx_lobster_encounters_message", + "columns": [ + "guild_id", + "channel_id", + "message_id" + ], + "isUnique": false + }, + "idx_lobster_encounters_species": { + "name": "idx_lobster_encounters_species", + "columns": [ + "species_aphia_id" + ], + "isUnique": false + }, + "idx_lobster_encounters_publication": { + "name": "idx_lobster_encounters_publication", + "columns": [ + "publication_status" + ], + "isUnique": false + }, + "idx_lobster_encounters_response": { + "name": "idx_lobster_encounters_response", + "columns": [ + "response_status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "nomination_approvals": { + "name": "nomination_approvals", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "nomination_id": { + "name": "nomination_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "approver_id": { + "name": "approver_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "vote_choice": { + "name": "vote_choice", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'approve'" + }, + "mutation_id": { + "name": "mutation_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_nomination_approvals_nomination_approver": { + "name": "idx_nomination_approvals_nomination_approver", + "columns": [ + "nomination_id", + "approver_id" + ], + "isUnique": true + }, + "idx_nomination_approvals_nomination_id": { + "name": "idx_nomination_approvals_nomination_id", + "columns": [ + "nomination_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "nominations": { + "name": "nominations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nominee_id": { + "name": "nominee_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nominator_id": { + "name": "nominator_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'No reason provided.'" + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_role_id": { + "name": "target_role_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "required_approvals": { + "name": "required_approvals", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "completed_at": { + "name": "completed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "desired_card_revision": { + "name": "desired_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "synced_card_revision": { + "name": "synced_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "card_sync_started_at": { + "name": "card_sync_started_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_sync_failure_count": { + "name": "card_sync_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "grant_started_at": { + "name": "grant_started_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "grant_failure_count": { + "name": "grant_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_nominations_active_unique": { + "name": "idx_nominations_active_unique", + "columns": [ + "guild_id", + "nominee_id", + "target_role_id" + ], + "isUnique": true, + "where": "\"nominations\".\"status\" in ('submitted', 'granting')" + }, + "idx_nominations_status": { + "name": "idx_nominations_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_nominations_card_sync": { + "name": "idx_nominations_card_sync", + "columns": [ + "desired_card_revision", + "synced_card_revision" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "reddit_moderation_contexts": { + "name": "reddit_moderation_contexts", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "subreddit": { + "name": "subreddit", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'moderated'" + }, + "unaction": { + "name": "unaction", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'reviewed'" + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "moderator": { + "name": "moderator", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banned_at": { + "name": "banned_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_reddit_moderation_contexts_subreddit_username": { + "name": "idx_reddit_moderation_contexts_subreddit_username", + "columns": [ + "subreddit", + "username" + ], + "isUnique": true + }, + "idx_reddit_moderation_contexts_username": { + "name": "idx_reddit_moderation_contexts_username", + "columns": [ + "username" + ], + "isUnique": false + }, + "idx_reddit_moderation_contexts_action": { + "name": "idx_reddit_moderation_contexts_action", + "columns": [ + "action" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_cases": { + "name": "review_cases", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_user_id": { + "name": "target_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'open'" + }, + "heuristic_score": { + "name": "heuristic_score", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "concordance": { + "name": "concordance", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "behavioral_families": { + "name": "behavioral_families", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_signals": { + "name": "key_signals", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'[]'" + }, + "evidence_message_id": { + "name": "evidence_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_probability": { + "name": "krill_probability", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_brief": { + "name": "krill_brief", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_model": { + "name": "krill_model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_channel_id": { + "name": "review_channel_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_status": { + "name": "delivery_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "previous_delivery_status": { + "name": "previous_delivery_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "delivery_nonce": { + "name": "delivery_nonce", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_preflight_completed_at": { + "name": "delivery_preflight_completed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_post_attempted_at": { + "name": "delivery_post_attempted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_claim_token": { + "name": "delivery_claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_claim_expires_at": { + "name": "delivery_claim_expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_claim_token": { + "name": "receipt_claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_claim_expires_at": { + "name": "receipt_claim_expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_next_attempt_at": { + "name": "receipt_next_attempt_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_history_before": { + "name": "receipt_history_before", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_revision": { + "name": "card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "synced_card_revision": { + "name": "synced_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "card_sync_next_attempt_at": { + "name": "card_sync_next_attempt_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_sync_failure_count": { + "name": "card_sync_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "review_cases_case_id_unique": { + "name": "review_cases_case_id_unique", + "columns": [ + "case_id" + ], + "isUnique": true + }, + "idx_review_cases_guild_target": { + "name": "idx_review_cases_guild_target", + "columns": [ + "guild_id", + "target_user_id" + ], + "isUnique": false + }, + "idx_review_cases_status": { + "name": "idx_review_cases_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_review_cases_review_msg": { + "name": "idx_review_cases_review_msg", + "columns": [ + "review_message_id" + ], + "isUnique": false + }, + "idx_review_cases_receipt_recovery": { + "name": "idx_review_cases_receipt_recovery", + "columns": [ + "guild_id", + "delivery_status", + "receipt_next_attempt_at", + "receipt_claim_expires_at" + ], + "isUnique": false + }, + "idx_review_cases_card_sync_due": { + "name": "idx_review_cases_card_sync_due", + "columns": [ + "card_sync_next_attempt_at", + "card_revision", + "synced_card_revision" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_observations": { + "name": "review_observations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "author_id": { + "name": "author_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reply_to_id": { + "name": "reply_to_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content_length": { + "name": "content_length", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "line_count": { + "name": "line_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fingerprint": { + "name": "fingerprint", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artifacts": { + "name": "artifacts", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "similarity": { + "name": "similarity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "semantic_score": { + "name": "semantic_score", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "review_observations_message_id_unique": { + "name": "review_observations_message_id_unique", + "columns": [ + "message_id" + ], + "isUnique": true + }, + "idx_review_obs_guild_author": { + "name": "idx_review_obs_guild_author", + "columns": [ + "guild_id", + "author_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_author": { + "name": "idx_review_obs_author", + "columns": [ + "author_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_channel": { + "name": "idx_review_obs_channel", + "columns": [ + "channel_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_message": { + "name": "idx_review_obs_message", + "columns": [ + "message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "slap_events": { + "name": "slap_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_is_bot": { + "name": "target_is_bot", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "fish_slug": { + "name": "fish_slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fish_name": { + "name": "fish_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rarity": { + "name": "rarity", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "outcome": { + "name": "outcome", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headline": { + "name": "headline", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "narrative": { + "name": "narrative", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "impact": { + "name": "impact", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "dignity_remaining": { + "name": "dignity_remaining", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fish_condition": { + "name": "fish_condition", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "counter_actor_id": { + "name": "counter_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_target_id": { + "name": "counter_target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_slug": { + "name": "counter_fish_slug", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_name": { + "name": "counter_fish_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_rarity": { + "name": "counter_rarity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_outcome": { + "name": "counter_outcome", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_headline": { + "name": "counter_headline", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_narrative": { + "name": "counter_narrative", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_impact": { + "name": "counter_impact", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_dignity_remaining": { + "name": "counter_dignity_remaining", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_condition": { + "name": "counter_fish_condition", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_image_url": { + "name": "counter_image_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "countered_at": { + "name": "countered_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appealed_by_id": { + "name": "appealed_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appeal_ruling": { + "name": "appeal_ruling", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appealed_at": { + "name": "appealed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "slap_events_interaction_id_unique": { + "name": "slap_events_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "idx_slap_events_actor_cooldown": { + "name": "idx_slap_events_actor_cooldown", + "columns": [ + "guild_id", + "actor_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_target_cooldown": { + "name": "idx_slap_events_target_cooldown", + "columns": [ + "guild_id", + "target_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_channel_cooldown": { + "name": "idx_slap_events_channel_cooldown", + "columns": [ + "guild_id", + "channel_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_message": { + "name": "idx_slap_events_message", + "columns": [ + "guild_id", + "channel_id", + "message_id" + ], + "isUnique": false + }, + "idx_slap_events_outcome": { + "name": "idx_slap_events_outcome", + "columns": [ + "outcome" + ], + "isUnique": false + }, + "idx_slap_events_rarity": { + "name": "idx_slap_events_rarity", + "columns": [ + "rarity" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tracked_threads": { + "name": "tracked_threads", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_checked": { + "name": "last_checked", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "solved": { + "name": "solved", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "warning_level": { + "name": "warning_level", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "closed": { + "name": "closed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_message_count": { + "name": "last_message_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "tracked_threads_thread_id_unique": { + "name": "tracked_threads_thread_id_unique", + "columns": [ + "thread_id" + ], + "isUnique": true + }, + "idx_tracked_threads_solved": { + "name": "idx_tracked_threads_solved", + "columns": [ + "solved" + ], + "isUnique": false + }, + "idx_tracked_threads_last_checked": { + "name": "idx_tracked_threads_last_checked", + "columns": [ + "last_checked" + ], + "isUnique": false + }, + "idx_tracked_threads_received_at": { + "name": "idx_tracked_threads_received_at", + "columns": [ + "received_at" + ], + "isUnique": false + }, + "idx_tracked_threads_closed": { + "name": "idx_tracked_threads_closed", + "columns": [ + "closed" + ], + "isUnique": false + }, + "idx_tracked_threads_warning_level": { + "name": "idx_tracked_threads_warning_level", + "columns": [ + "warning_level" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/0017_snapshot.json b/drizzle/meta/0017_snapshot.json new file mode 100644 index 0000000..3f5c0ca --- /dev/null +++ b/drizzle/meta/0017_snapshot.json @@ -0,0 +1,2604 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "ecff7a8a-4fe9-4a50-a686-6bfeec399141", + "prevId": "7498e5bb-f7e3-410c-bdd8-2b76656dde5c", + "tables": { + "action_cooldown_events": { + "name": "action_cooldown_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action_kind": { + "name": "action_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor_expires_at": { + "name": "actor_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_expires_at": { + "name": "target_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_expires_at": { + "name": "channel_expires_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "action_cooldown_events_interaction_id_unique": { + "name": "action_cooldown_events_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "idx_action_cooldowns_actor": { + "name": "idx_action_cooldowns_actor", + "columns": [ + "guild_id", + "actor_id", + "actor_expires_at" + ], + "isUnique": false + }, + "idx_action_cooldowns_target": { + "name": "idx_action_cooldowns_target", + "columns": [ + "guild_id", + "target_id", + "target_expires_at" + ], + "isUnique": false + }, + "idx_action_cooldowns_channel": { + "name": "idx_action_cooldowns_channel", + "columns": [ + "guild_id", + "channel_id", + "channel_expires_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "claim_requests": { + "name": "claim_requests", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "github_username": { + "name": "github_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "merged_pr_count": { + "name": "merged_pr_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_thread_id": { + "name": "review_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_at": { + "name": "decided_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_claim_requests_guild_user": { + "name": "idx_claim_requests_guild_user", + "columns": [ + "guild_id", + "user_id" + ], + "isUnique": true + }, + "idx_claim_requests_user_id": { + "name": "idx_claim_requests_user_id", + "columns": [ + "user_id" + ], + "isUnique": false + }, + "idx_claim_requests_status": { + "name": "idx_claim_requests_status", + "columns": [ + "status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_cases": { + "name": "clawhub_content_rights_cases", + "columns": { + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "form_submission_id": { + "name": "form_submission_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "requester_name": { + "name": "requester_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organization": { + "name": "organization", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "clawhub_urls": { + "name": "clawhub_urls", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "explanation": { + "name": "explanation", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "clawhub_content_rights_cases_form_submission_id_unique": { + "name": "clawhub_content_rights_cases_form_submission_id_unique", + "columns": [ + "form_submission_id" + ], + "isUnique": true + }, + "idx_clawhub_content_rights_cases_status": { + "name": "idx_clawhub_content_rights_cases_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_clawhub_content_rights_cases_email": { + "name": "idx_clawhub_content_rights_cases_email", + "columns": [ + "email" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_events": { + "name": "clawhub_content_rights_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "actor": { + "name": "actor", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_clawhub_content_rights_events_case_id": { + "name": "idx_clawhub_content_rights_events_case_id", + "columns": [ + "case_id" + ], + "isUnique": false + }, + "idx_clawhub_content_rights_events_event_type": { + "name": "idx_clawhub_content_rights_events_event_type", + "columns": [ + "event_type" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "clawhub_content_rights_files": { + "name": "clawhub_content_rights_files", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "object_key": { + "name": "object_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "original_name": { + "name": "original_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "size_bytes": { + "name": "size_bytes", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "clawhub_content_rights_files_object_key_unique": { + "name": "clawhub_content_rights_files_object_key_unique", + "columns": [ + "object_key" + ], + "isUnique": true + }, + "idx_clawhub_content_rights_files_case_id": { + "name": "idx_clawhub_content_rights_files_case_id", + "columns": [ + "case_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "form_submissions": { + "name": "form_submissions", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "form_id": { + "name": "form_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "auth_provider": { + "name": "auth_provider", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applicant_id": { + "name": "applicant_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "applicant_username": { + "name": "applicant_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_channel_id": { + "name": "review_channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_thread_id": { + "name": "review_thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_at": { + "name": "decided_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "action_result": { + "name": "action_result", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_form_submissions_form_id": { + "name": "idx_form_submissions_form_id", + "columns": [ + "form_id" + ], + "isUnique": false + }, + "idx_form_submissions_status": { + "name": "idx_form_submissions_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_form_submissions_applicant_id": { + "name": "idx_form_submissions_applicant_id", + "columns": [ + "applicant_id" + ], + "isUnique": false + }, + "idx_form_submissions_review_message_id": { + "name": "idx_form_submissions_review_message_id", + "columns": [ + "review_message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "helper_events": { + "name": "helper_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "event_type": { + "name": "event_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'helper_command'" + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message_count": { + "name": "message_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "event_time": { + "name": "event_time", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "command": { + "name": "command", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "invoked_by_id": { + "name": "invoked_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoked_by_username": { + "name": "invoked_by_username", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "invoked_by_global_name": { + "name": "invoked_by_global_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "idx_helper_events_event_time": { + "name": "idx_helper_events_event_time", + "columns": [ + "event_time" + ], + "isUnique": false + }, + "idx_helper_events_command": { + "name": "idx_helper_events_command", + "columns": [ + "command" + ], + "isUnique": false + }, + "idx_helper_events_thread_id": { + "name": "idx_helper_events_thread_id", + "columns": [ + "thread_id" + ], + "isUnique": false + }, + "idx_helper_events_invoked_by_id": { + "name": "idx_helper_events_invoked_by_id", + "columns": [ + "invoked_by_id" + ], + "isUnique": false + }, + "idx_helper_events_event_type": { + "name": "idx_helper_events_event_type", + "columns": [ + "event_type" + ], + "isUnique": false + }, + "idx_helper_events_thread_time": { + "name": "idx_helper_events_thread_time", + "columns": [ + "thread_id", + "event_time" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "keyValue": { + "name": "keyValue", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "lobster_encounters": { + "name": "lobster_encounters", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cooldown_event_id": { + "name": "cooldown_event_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_is_bot": { + "name": "target_is_bot", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "taxonomy_snapshot_id": { + "name": "taxonomy_snapshot_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_aphia_id": { + "name": "species_aphia_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_accepted_name": { + "name": "species_accepted_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_display_name": { + "name": "species_display_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "species_family": { + "name": "species_family", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scene_id": { + "name": "scene_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_url": { + "name": "asset_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_checksum": { + "name": "asset_checksum", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headline": { + "name": "headline", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "narrative": { + "name": "narrative", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metrics_json": { + "name": "metrics_json", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accessibility_description": { + "name": "accessibility_description", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "publication_status": { + "name": "publication_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "publication_failure": { + "name": "publication_failure", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "publication_failed_at": { + "name": "publication_failed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "message_bound_at": { + "name": "message_bound_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_status": { + "name": "response_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "response_type": { + "name": "response_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_actor_id": { + "name": "response_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "responded_at": { + "name": "responded_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "response_result_json": { + "name": "response_result_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_actor_id": { + "name": "counter_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_target_id": { + "name": "counter_target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_scene_id": { + "name": "counter_scene_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_asset_url": { + "name": "counter_asset_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_asset_checksum": { + "name": "counter_asset_checksum", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_headline": { + "name": "counter_headline", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_narrative": { + "name": "counter_narrative", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_metrics_json": { + "name": "counter_metrics_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_accessibility_description": { + "name": "counter_accessibility_description", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "lobster_encounters_interaction_id_unique": { + "name": "lobster_encounters_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "lobster_encounters_cooldown_event_id_unique": { + "name": "lobster_encounters_cooldown_event_id_unique", + "columns": [ + "cooldown_event_id" + ], + "isUnique": true + }, + "idx_lobster_encounters_message": { + "name": "idx_lobster_encounters_message", + "columns": [ + "guild_id", + "channel_id", + "message_id" + ], + "isUnique": false + }, + "idx_lobster_encounters_species": { + "name": "idx_lobster_encounters_species", + "columns": [ + "species_aphia_id" + ], + "isUnique": false + }, + "idx_lobster_encounters_publication": { + "name": "idx_lobster_encounters_publication", + "columns": [ + "publication_status" + ], + "isUnique": false + }, + "idx_lobster_encounters_response": { + "name": "idx_lobster_encounters_response", + "columns": [ + "response_status" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "nomination_approvals": { + "name": "nomination_approvals", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "nomination_id": { + "name": "nomination_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "approver_id": { + "name": "approver_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "vote_choice": { + "name": "vote_choice", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'approve'" + }, + "mutation_id": { + "name": "mutation_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_nomination_approvals_nomination_approver": { + "name": "idx_nomination_approvals_nomination_approver", + "columns": [ + "nomination_id", + "approver_id" + ], + "isUnique": true + }, + "idx_nomination_approvals_nomination_id": { + "name": "idx_nomination_approvals_nomination_id", + "columns": [ + "nomination_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "nominations": { + "name": "nominations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nominee_id": { + "name": "nominee_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "nominator_id": { + "name": "nominator_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'No reason provided.'" + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "target_role_id": { + "name": "target_role_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "required_approvals": { + "name": "required_approvals", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'submitted'" + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "completed_at": { + "name": "completed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "desired_card_revision": { + "name": "desired_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "synced_card_revision": { + "name": "synced_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "card_sync_started_at": { + "name": "card_sync_started_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_sync_failure_count": { + "name": "card_sync_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "grant_started_at": { + "name": "grant_started_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "grant_failure_count": { + "name": "grant_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_nominations_active_unique": { + "name": "idx_nominations_active_unique", + "columns": [ + "guild_id", + "nominee_id", + "target_role_id" + ], + "isUnique": true, + "where": "\"nominations\".\"status\" in ('submitted', 'granting')" + }, + "idx_nominations_status": { + "name": "idx_nominations_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_nominations_card_sync": { + "name": "idx_nominations_card_sync", + "columns": [ + "desired_card_revision", + "synced_card_revision" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "reddit_moderation_contexts": { + "name": "reddit_moderation_contexts", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "subreddit": { + "name": "subreddit", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'moderated'" + }, + "unaction": { + "name": "unaction", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'reviewed'" + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "moderator": { + "name": "moderator", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banned_at": { + "name": "banned_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_reddit_moderation_contexts_subreddit_username": { + "name": "idx_reddit_moderation_contexts_subreddit_username", + "columns": [ + "subreddit", + "username" + ], + "isUnique": true + }, + "idx_reddit_moderation_contexts_username": { + "name": "idx_reddit_moderation_contexts_username", + "columns": [ + "username" + ], + "isUnique": false + }, + "idx_reddit_moderation_contexts_action": { + "name": "idx_reddit_moderation_contexts_action", + "columns": [ + "action" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_card_write_attempts": { + "name": "review_card_write_attempts", + "columns": { + "attempt_token": { + "name": "attempt_token", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rendered_revision": { + "name": "rendered_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "claim_token": { + "name": "claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "claim_expires_at": { + "name": "claim_expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "next_attempt_at": { + "name": "next_attempt_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "failure_count": { + "name": "failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "idx_review_card_write_attempts_due": { + "name": "idx_review_card_write_attempts_due", + "columns": [ + "guild_id", + "next_attempt_at", + "claim_expires_at", + "created_at" + ], + "isUnique": false + }, + "idx_review_card_write_attempts_case": { + "name": "idx_review_card_write_attempts_case", + "columns": [ + "case_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_cases": { + "name": "review_cases", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "case_id": { + "name": "case_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_user_id": { + "name": "target_user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'open'" + }, + "heuristic_score": { + "name": "heuristic_score", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "concordance": { + "name": "concordance", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "behavioral_families": { + "name": "behavioral_families", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "key_signals": { + "name": "key_signals", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'[]'" + }, + "evidence_message_id": { + "name": "evidence_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_probability": { + "name": "krill_probability", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_brief": { + "name": "krill_brief", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "krill_model": { + "name": "krill_model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_message_id": { + "name": "review_message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "review_channel_id": { + "name": "review_channel_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_status": { + "name": "delivery_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "previous_delivery_status": { + "name": "previous_delivery_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "delivery_nonce": { + "name": "delivery_nonce", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_preflight_completed_at": { + "name": "delivery_preflight_completed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_post_attempted_at": { + "name": "delivery_post_attempted_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_attempt_state": { + "name": "delivery_attempt_state", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'legacy_unknown'" + }, + "delivery_claim_token": { + "name": "delivery_claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "delivery_claim_expires_at": { + "name": "delivery_claim_expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_claim_token": { + "name": "receipt_claim_token", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_claim_expires_at": { + "name": "receipt_claim_expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_next_attempt_at": { + "name": "receipt_next_attempt_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "receipt_history_before": { + "name": "receipt_history_before", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_revision": { + "name": "card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "synced_card_revision": { + "name": "synced_card_revision", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 1 + }, + "card_sync_next_attempt_at": { + "name": "card_sync_next_attempt_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "card_sync_failure_count": { + "name": "card_sync_failure_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "expires_at": { + "name": "expires_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decided_by_id": { + "name": "decided_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decision_reason": { + "name": "decision_reason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "review_cases_case_id_unique": { + "name": "review_cases_case_id_unique", + "columns": [ + "case_id" + ], + "isUnique": true + }, + "idx_review_cases_guild_target": { + "name": "idx_review_cases_guild_target", + "columns": [ + "guild_id", + "target_user_id" + ], + "isUnique": false + }, + "idx_review_cases_status": { + "name": "idx_review_cases_status", + "columns": [ + "status" + ], + "isUnique": false + }, + "idx_review_cases_review_msg": { + "name": "idx_review_cases_review_msg", + "columns": [ + "review_message_id" + ], + "isUnique": false + }, + "idx_review_cases_receipt_recovery": { + "name": "idx_review_cases_receipt_recovery", + "columns": [ + "guild_id", + "delivery_status", + "receipt_next_attempt_at", + "receipt_claim_expires_at" + ], + "isUnique": false + }, + "idx_review_cases_card_sync_due": { + "name": "idx_review_cases_card_sync_due", + "columns": [ + "card_sync_next_attempt_at", + "card_revision", + "synced_card_revision" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "review_observations": { + "name": "review_observations", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "author_id": { + "name": "author_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "reply_to_id": { + "name": "reply_to_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content_length": { + "name": "content_length", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "line_count": { + "name": "line_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fingerprint": { + "name": "fingerprint", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artifacts": { + "name": "artifacts", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "similarity": { + "name": "similarity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "semantic_score": { + "name": "semantic_score", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "review_observations_message_id_unique": { + "name": "review_observations_message_id_unique", + "columns": [ + "message_id" + ], + "isUnique": true + }, + "idx_review_obs_guild_author": { + "name": "idx_review_obs_guild_author", + "columns": [ + "guild_id", + "author_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_author": { + "name": "idx_review_obs_author", + "columns": [ + "author_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_channel": { + "name": "idx_review_obs_channel", + "columns": [ + "channel_id", + "created_at" + ], + "isUnique": false + }, + "idx_review_obs_message": { + "name": "idx_review_obs_message", + "columns": [ + "message_id" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "slap_events": { + "name": "slap_events", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "interaction_id": { + "name": "interaction_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "guild_id": { + "name": "guild_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "channel_id": { + "name": "channel_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "message_id": { + "name": "message_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_id": { + "name": "target_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "target_is_bot": { + "name": "target_is_bot", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "fish_slug": { + "name": "fish_slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fish_name": { + "name": "fish_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rarity": { + "name": "rarity", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "outcome": { + "name": "outcome", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "headline": { + "name": "headline", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "narrative": { + "name": "narrative", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "impact": { + "name": "impact", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "dignity_remaining": { + "name": "dignity_remaining", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "fish_condition": { + "name": "fish_condition", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "counter_actor_id": { + "name": "counter_actor_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_target_id": { + "name": "counter_target_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_slug": { + "name": "counter_fish_slug", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_name": { + "name": "counter_fish_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_rarity": { + "name": "counter_rarity", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_outcome": { + "name": "counter_outcome", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_headline": { + "name": "counter_headline", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_narrative": { + "name": "counter_narrative", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_impact": { + "name": "counter_impact", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_dignity_remaining": { + "name": "counter_dignity_remaining", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_fish_condition": { + "name": "counter_fish_condition", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "counter_image_url": { + "name": "counter_image_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "countered_at": { + "name": "countered_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appealed_by_id": { + "name": "appealed_by_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appeal_ruling": { + "name": "appeal_ruling", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "appealed_at": { + "name": "appealed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + } + }, + "indexes": { + "slap_events_interaction_id_unique": { + "name": "slap_events_interaction_id_unique", + "columns": [ + "interaction_id" + ], + "isUnique": true + }, + "idx_slap_events_actor_cooldown": { + "name": "idx_slap_events_actor_cooldown", + "columns": [ + "guild_id", + "actor_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_target_cooldown": { + "name": "idx_slap_events_target_cooldown", + "columns": [ + "guild_id", + "target_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_channel_cooldown": { + "name": "idx_slap_events_channel_cooldown", + "columns": [ + "guild_id", + "channel_id", + "created_at" + ], + "isUnique": false + }, + "idx_slap_events_message": { + "name": "idx_slap_events_message", + "columns": [ + "guild_id", + "channel_id", + "message_id" + ], + "isUnique": false + }, + "idx_slap_events_outcome": { + "name": "idx_slap_events_outcome", + "columns": [ + "outcome" + ], + "isUnique": false + }, + "idx_slap_events_rarity": { + "name": "idx_slap_events_rarity", + "columns": [ + "rarity" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "tracked_threads": { + "name": "tracked_threads", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "thread_id": { + "name": "thread_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_checked": { + "name": "last_checked", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "solved": { + "name": "solved", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "warning_level": { + "name": "warning_level", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "closed": { + "name": "closed", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "last_message_count": { + "name": "last_message_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "received_at": { + "name": "received_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" + }, + "raw_payload": { + "name": "raw_payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "tracked_threads_thread_id_unique": { + "name": "tracked_threads_thread_id_unique", + "columns": [ + "thread_id" + ], + "isUnique": true + }, + "idx_tracked_threads_solved": { + "name": "idx_tracked_threads_solved", + "columns": [ + "solved" + ], + "isUnique": false + }, + "idx_tracked_threads_last_checked": { + "name": "idx_tracked_threads_last_checked", + "columns": [ + "last_checked" + ], + "isUnique": false + }, + "idx_tracked_threads_received_at": { + "name": "idx_tracked_threads_received_at", + "columns": [ + "received_at" + ], + "isUnique": false + }, + "idx_tracked_threads_closed": { + "name": "idx_tracked_threads_closed", + "columns": [ + "closed" + ], + "isUnique": false + }, + "idx_tracked_threads_warning_level": { + "name": "idx_tracked_threads_warning_level", + "columns": [ + "warning_level" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 218dae8..a6589c1 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -92,6 +92,41 @@ "when": 1784999050821, "tag": "0012_remove_form_review_locks", "breakpoints": true + }, + { + "idx": 13, + "version": "6", + "when": 1789608774724, + "tag": "0013_reflective_rictor", + "breakpoints": true + }, + { + "idx": 14, + "version": "6", + "when": 1789849153150, + "tag": "0014_review_recovery_ownership", + "breakpoints": true + }, + { + "idx": 15, + "version": "6", + "when": 1789850253611, + "tag": "0015_review_delivery_attempt_state", + "breakpoints": true + }, + { + "idx": 16, + "version": "6", + "when": 1789851318356, + "tag": "0016_chilly_loners", + "breakpoints": true + }, + { + "idx": 17, + "version": "6", + "when": 1789869870203, + "tag": "0017_optimal_leopardon", + "breakpoints": true } ] } \ No newline at end of file diff --git a/forwarder/src/discrawlServer.ts b/forwarder/src/discrawlServer.ts new file mode 100644 index 0000000..afe8de9 --- /dev/null +++ b/forwarder/src/discrawlServer.ts @@ -0,0 +1,108 @@ +import fs from "node:fs" +import { + getRecentDiscrawlObservations, + getDiscrawlObservationCount +} from "../../src/services/discrawl.js" + +export interface DiscrawlServerOptions { + exportPath: string + secret: string + port?: number +} + +export const startDiscrawlServer = (options: DiscrawlServerOptions) => { + const { exportPath, secret, port = 3002 } = options + + return Bun.serve({ + port, + async fetch(req) { + const url = new URL(req.url) + + // Authenticate with Bearer token + const auth = req.headers.get("Authorization") + if (!auth || auth !== `Bearer ${secret}`) { + return new Response(JSON.stringify({ error: "Unauthorized" }), { + status: 401, + headers: { "Content-Type": "application/json" } + }) + } + + if (req.method !== "GET") { + return new Response(JSON.stringify({ error: "Method not allowed" }), { + status: 405, + headers: { "Content-Type": "application/json" } + }) + } + + if (url.pathname === "/api/discrawl/health") { + return new Response( + JSON.stringify({ + status: "ok", + exportPathExists: fs.existsSync(exportPath) + }), + { + status: 200, + headers: { "Content-Type": "application/json" } + } + ) + } + + if (url.pathname === "/api/discrawl/observations") { + const guildId = url.searchParams.get("guildId") || "" + const authorId = url.searchParams.get("authorId") || "" + const windowDays = Number(url.searchParams.get("windowDays") || 7) + const limit = Number(url.searchParams.get("limit") || 200) + + if (!authorId) { + return new Response(JSON.stringify({ error: "Missing authorId" }), { + status: 400, + headers: { "Content-Type": "application/json" } + }) + } + + const observations = getRecentDiscrawlObservations( + exportPath, + guildId, + authorId, + windowDays, + limit + ) + + return new Response(JSON.stringify(observations), { + status: 200, + headers: { "Content-Type": "application/json" } + }) + } + + if (url.pathname === "/api/discrawl/count") { + const guildId = url.searchParams.get("guildId") || "" + const authorId = url.searchParams.get("authorId") || "" + const windowDays = Number(url.searchParams.get("windowDays") || 7) + + if (!authorId) { + return new Response(JSON.stringify({ error: "Missing authorId" }), { + status: 400, + headers: { "Content-Type": "application/json" } + }) + } + + const count = getDiscrawlObservationCount( + exportPath, + guildId, + authorId, + windowDays + ) + + return new Response(JSON.stringify({ count }), { + status: 200, + headers: { "Content-Type": "application/json" } + }) + } + + return new Response(JSON.stringify({ error: "Not found" }), { + status: 404, + headers: { "Content-Type": "application/json" } + }) + } + }) +} diff --git a/forwarder/src/index.ts b/forwarder/src/index.ts index 61e420b..5059140 100644 --- a/forwarder/src/index.ts +++ b/forwarder/src/index.ts @@ -3,6 +3,7 @@ import { GatewayForwarderPlugin, GatewayIntents } from "@buape/carbon/gateway-forwarder" +import { startDiscrawlServer } from "./discrawlServer.js" const { BASE_URL, @@ -10,7 +11,10 @@ const { DISCORD_CLIENT_ID, DISCORD_PUBLIC_KEY, DISCORD_BOT_TOKEN, - FORWARDER_PRIVATE_KEY + FORWARDER_PRIVATE_KEY, + DISCRAWL_EXPORT_PATH, + DISCRAWL_SERVER_PORT, + DISCRAWL_SECRET } = Bun.env if ( @@ -47,3 +51,14 @@ const client = new Client( ) console.log(`Gateway forwarder ready to forward events to ${BASE_URL}/events`) + +if (DISCRAWL_EXPORT_PATH) { + const port = Number(DISCRAWL_SERVER_PORT || 3002) + const secret = DISCRAWL_SECRET || DEPLOY_SECRET + startDiscrawlServer({ + exportPath: DISCRAWL_EXPORT_PATH, + secret, + port + }) + console.log(`Discrawl export server listening on port ${port}`) +} diff --git a/forwarder/tsconfig.json b/forwarder/tsconfig.json index ceca271..95e0eab 100644 --- a/forwarder/tsconfig.json +++ b/forwarder/tsconfig.json @@ -8,7 +8,7 @@ "module": "ESNext", "moduleResolution": "Bundler", "types": ["bun"], - "rootDir": "src", + "rootDir": "..", "outDir": "dist" } } diff --git a/scripts/lib/reviewLiveProofConfig.ts b/scripts/lib/reviewLiveProofConfig.ts new file mode 100644 index 0000000..7a3019e --- /dev/null +++ b/scripts/lib/reviewLiveProofConfig.ts @@ -0,0 +1,23 @@ +/** Fail closed before importing any network-capable proof dependency. */ +export function readLiveProofConfig(env: Record) { + const required = (name: string) => { + const value = env[name]?.trim() + if (!value) throw new Error(`Missing ${name}`) + return value + } + const snowflake = (name: string) => { + const value = required(name) + if (!/^[1-9][0-9]{16,19}$/.test(value)) throw new Error(`Invalid ${name}`) + return value + } + const guildId = snowflake("HERMIT_PROOF_GUILD_ID") + const channelId = snowflake("HERMIT_PROOF_CHANNEL_ID") + const botId = snowflake("DISCORD_CLIENT_ID") + if (guildId === "1456350064065904867" || channelId === "1519064274561929328") { + throw new Error("Live proof refuses the production review guild/channel") + } + if (env.ENABLE_AUTOMATIC_SCREENING === "1" || env.ENABLE_AUTOMATIC_SCREENING === "true") { + throw new Error("Automatic screening must remain disabled") + } + return { guildId, channelId, botId, token: required("DISCORD_BOT_TOKEN") } +} diff --git a/scripts/lib/reviewMigrationProof.ts b/scripts/lib/reviewMigrationProof.ts new file mode 100644 index 0000000..c7068c6 --- /dev/null +++ b/scripts/lib/reviewMigrationProof.ts @@ -0,0 +1,221 @@ +import assert from "node:assert/strict" +import { mkdir, readFile, writeFile } from "node:fs/promises" +import { resolve } from "node:path" +import { getPlatformProxy } from "wrangler" + +export async function applyReviewMigrations(db: D1Database, directory: string, files: string[]) { + for (const file of files) { + const source = await readFile(resolve(directory, file), "utf8") + for (const statement of source.split("--> statement-breakpoint").map((part) => part.trim()).filter(Boolean)) { + await db.prepare(statement).run() + } + } +} + +export async function assertReviewSchema(db: D1Database) { + const columns = (await db.prepare("PRAGMA table_info(review_cases)") + .all<{ name: string; type: string; notnull: number; dflt_value: string | null }>()).results + for (const [name, type] of [ + ["card_revision", "INTEGER"], ["synced_card_revision", "INTEGER"], + ["previous_delivery_status", "TEXT"], ["review_message_id", "TEXT"], + ["review_channel_id", "TEXT"], ["delivery_nonce", "TEXT"], + ["delivery_claim_token", "TEXT"], ["delivery_claim_expires_at", "TEXT"], + ["receipt_claim_token", "TEXT"], ["receipt_claim_expires_at", "TEXT"], + ["receipt_next_attempt_at", "TEXT"], ["receipt_history_before", "TEXT"], + ["card_sync_next_attempt_at", "TEXT"], ["card_sync_failure_count", "INTEGER"], + ["delivery_preflight_completed_at", "TEXT"], ["delivery_post_attempted_at", "TEXT"], + ["delivery_attempt_state", "TEXT"], ["key_signals", "TEXT"] + ]) { + const column = columns.find((item) => item.name === name) + assert(column, `Missing review_cases.${name}`) + assert.equal(column.type.toUpperCase(), type) + } + for (const name of [ + "card_revision", "synced_card_revision", "previous_delivery_status", "card_sync_failure_count", + "key_signals", "delivery_attempt_state" + ]) { + assert.equal(columns.find((item) => item.name === name)?.notnull, 1) + } + assert.equal(columns.find((item) => item.name === "card_sync_failure_count")?.dflt_value, "0") + assert.equal(columns.find((item) => item.name === "key_signals")?.dflt_value, "'[]'") + assert.equal(columns.find((item) => item.name === "delivery_attempt_state")?.dflt_value, "'legacy_unknown'") + const indexes = (await db.prepare("SELECT name FROM sqlite_master WHERE type = 'index'") + .all<{ name: string }>()).results.map((item) => item.name) + for (const name of [ + "review_cases_case_id_unique", "idx_review_cases_guild_target", "idx_review_cases_status", + "idx_review_cases_review_msg", "idx_review_cases_receipt_recovery", + "idx_review_cases_card_sync_due", "review_observations_message_id_unique", + "idx_review_card_write_attempts_due", "idx_review_card_write_attempts_case", + "idx_review_obs_guild_author", "idx_review_obs_author", "idx_review_obs_channel", "idx_review_obs_message" + ]) assert(indexes.includes(name), `Missing index ${name}`) + assert(await db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'review_card_write_attempts'").first()) + + const insert = `INSERT INTO review_cases + (case_id, guild_id, target_user_id, heuristic_score, concordance, behavioral_families) + VALUES ('schema-proof-case', 'synthetic-guild', 'synthetic-user', 0, 'Low', '[]')` + await db.prepare(insert).run() + const created = await db.prepare("SELECT * FROM review_cases WHERE case_id = 'schema-proof-case'") + .first<{ card_revision: number; synced_card_revision: number; status: string }>() + assert(created) + assert.equal(created.card_revision, 1) + assert.equal(created.synced_card_revision, 1) + assert.equal(created.status, "open") + await assert.rejects(() => db.prepare(insert).run(), /UNIQUE/i) + await db.prepare("UPDATE review_cases SET card_revision = card_revision + 1 WHERE case_id = 'schema-proof-case'").run() + assert.equal((await db.prepare("SELECT card_revision FROM review_cases WHERE case_id = 'schema-proof-case'") + .first<{ card_revision: number }>())?.card_revision, 2) + await db.prepare("DELETE FROM review_cases WHERE case_id = 'schema-proof-case'").run() + + const observation = `INSERT INTO review_observations + (message_id, guild_id, channel_id, author_id, created_at, content_length, line_count, fingerprint, artifacts) + VALUES ('schema-proof-message', 'synthetic-guild', 'synthetic-channel', 'synthetic-user', + '2026-01-01T00:00:00.000Z', 0, 0, 'synthetic', '[]')` + await db.prepare(observation).run() + await assert.rejects(() => db.prepare(observation).run(), /UNIQUE/i) + await db.prepare("DELETE FROM review_observations WHERE message_id = 'schema-proof-message'").run() +} + +const identifier = (name: string) => `"${name.replaceAll('"', '""')}"` +const canonicalRow = (row: Record) => + JSON.stringify(Object.fromEntries(Object.keys(row).sort().map((key) => [key, row[key]]))) + +export async function snapshotLegacyTables(db: D1Database, tableNames: string[]) { + const result: Record = {} + for (const table of tableNames) { + const schema = await db.prepare( + "SELECT type, name, tbl_name, sql FROM sqlite_master WHERE tbl_name = ? ORDER BY type, name" + ).bind(table).all() + const rows = await db.prepare(`SELECT * FROM ${identifier(table)}`).all>() + const sequence = await db.prepare("SELECT seq FROM sqlite_sequence WHERE name = ?").bind(table).first() + result[table] = { schema: schema.results, rows: rows.results.map(canonicalRow).sort(), sequence } + } + return result +} + +export async function verifyPopulatedReviewUpgrade( + directory: string, + files: string[], + proofRoot: string, + registerDisposer: (dispose: () => Promise) => void +) { + const split = files.findIndex((file) => file.startsWith("0013_")) + assert.equal(split, 13, "Expected migrations 0000 through 0012 before review schema") + for (let index = 0; index < files.length; index++) { + assert(files[index]?.startsWith(`${String(index).padStart(4, "0")}_`), "Migration sequence has a gap") + } + const upgradeRoot = resolve(proofRoot, "populated-upgrade") + await mkdir(upgradeRoot, { recursive: true }) + const configPath = resolve(upgradeRoot, "wrangler.json") + await writeFile(configPath, JSON.stringify({ + name: "hermit-review-upgrade-proof", + compatibility_date: "2026-09-08", + compatibility_flags: ["nodejs_compat"], + d1_databases: [{ binding: "DB", database_name: "hermit-upgrade-proof", database_id: "00000000-0000-0000-0000-000000000002" }] + })) + const proxy = await getPlatformProxy<{ DB: D1Database }>({ + configPath, envFiles: [], remoteBindings: false, + persist: { path: resolve(upgradeRoot, "state") } + }) + let disposed = false + const dispose = async () => { + if (!disposed) { + await proxy.dispose() + disposed = true + } + } + // The outer owner retries disposal before deleting either persistence tree. + registerDisposer(dispose) + let originalError: unknown + try { + const db = proxy.env.DB + await applyReviewMigrations(db, directory, files.slice(0, split)) + assert.equal(await db.prepare("SELECT name FROM sqlite_master WHERE name = 'review_cases'").first(), null) + await db.prepare("INSERT INTO keyValue (key, value, createdAt, updatedAt) VALUES ('proof-key-1', 'initial-data-val', 1700000000000, 1700000000000)").run() + await db.prepare("INSERT INTO tracked_threads (thread_id, created_at, solved, raw_payload) VALUES ('thread-proof-1', '2026-09-01T00:00:00.000Z', 1, '{}')").run() + const tables = (await db.prepare( + "SELECT name FROM sqlite_master WHERE type = 'table' AND name NOT LIKE 'sqlite_%' AND name NOT LIKE '_cf_%' ORDER BY name" + ) + .all<{ name: string }>()).results.map((item) => item.name) + const before = await snapshotLegacyTables(db, tables) + + // Install the original review schema, then prove populated review rows + // survive the additive ownership and delivery-attempt migrations too. + await applyReviewMigrations(db, directory, files.slice(split, split + 1)) + await db.prepare(`INSERT INTO review_cases ( + case_id, guild_id, target_user_id, status, heuristic_score, concordance, + behavioral_families, evidence_message_id, krill_probability, krill_brief, + krill_model, review_message_id, review_channel_id, delivery_status, + previous_delivery_status, card_revision, synced_card_revision, decided_by_id, + decision_reason, created_at, updated_at + ) VALUES ( + 'populated-review-case', 'synthetic-guild', 'synthetic-user', 'dismissed', + 87, 'High', '["cadence"]', 'evidence-message', '0.91', 'synthetic brief', + 'synthetic-model', 'review-message', 'review-channel', 'uncertain', + 'delivering', 7, 5, 'synthetic-staff', 'synthetic decision', + '2026-09-01T00:00:00.000Z', '2026-09-02T00:00:00.000Z' + )`).run() + const reviewColumns = (await db.prepare("PRAGMA table_info(review_cases)") + .all<{ name: string }>()).results.map((column) => column.name) + const reviewProjection = reviewColumns.map(identifier).join(", ") + const reviewBefore = await db.prepare( + `SELECT ${reviewProjection} FROM review_cases WHERE case_id = 'populated-review-case'` + ).first>() + assert(reviewBefore) + + // The remaining additive migrations happen only after the populated row exists. + await applyReviewMigrations(db, directory, files.slice(split + 1)) + assert.deepEqual(await snapshotLegacyTables(db, tables), before) + const reviewAfter = await db.prepare( + `SELECT ${reviewProjection} FROM review_cases WHERE case_id = 'populated-review-case'` + ).first>() + assert.deepEqual(reviewAfter, reviewBefore) + const additiveDefaults = await db.prepare(`SELECT + delivery_nonce, delivery_claim_token, delivery_claim_expires_at, + receipt_claim_token, receipt_claim_expires_at, receipt_next_attempt_at, + receipt_history_before, card_sync_next_attempt_at, card_sync_failure_count, + delivery_preflight_completed_at, delivery_post_attempted_at, + delivery_attempt_state, key_signals + FROM review_cases WHERE case_id = 'populated-review-case'`) + .first>() + assert(additiveDefaults) + assert.deepEqual(additiveDefaults, { + delivery_nonce: null, + delivery_claim_token: null, + delivery_claim_expires_at: null, + receipt_claim_token: null, + receipt_claim_expires_at: null, + receipt_next_attempt_at: null, + receipt_history_before: null, + card_sync_next_attempt_at: null, + card_sync_failure_count: 0, + delivery_preflight_completed_at: null, + delivery_post_attempted_at: null, + delivery_attempt_state: "legacy_unknown", + key_signals: "[]" + }) + await assertReviewSchema(db) + + // Negative control: the same preservation assertion must detect damage. + await db.prepare("UPDATE keyValue SET value = 'deliberately-corrupted' WHERE key = 'proof-key-1'").run() + const corrupted = await snapshotLegacyTables(db, tables) + assert.throws(() => assert.deepEqual(corrupted, before), { name: "AssertionError" }) + await db.prepare("UPDATE keyValue SET value = 'initial-data-val' WHERE key = 'proof-key-1'").run() + assert.deepEqual(await snapshotLegacyTables(db, tables), before) + await db.prepare("UPDATE review_cases SET decision_reason = 'deliberately-corrupted' WHERE case_id = 'populated-review-case'").run() + const corruptedReview = await db.prepare( + `SELECT ${reviewProjection} FROM review_cases WHERE case_id = 'populated-review-case'` + ).first>() + assert.throws(() => assert.deepEqual(corruptedReview, reviewBefore), { name: "AssertionError" }) + console.log(`Local D1 populated upgrade verified: ${files[split]} through ${files.at(-1)}; negative control detected corruption.`) + } catch (error) { + originalError = error + throw error + } finally { + try { + await dispose() + } catch (cleanupError) { + if (originalError) console.error("Upgrade proxy disposal also failed:", cleanupError) + else throw cleanupError + } + } +} diff --git a/scripts/lib/reviewProofCard.ts b/scripts/lib/reviewProofCard.ts new file mode 100644 index 0000000..4f3f1ee --- /dev/null +++ b/scripts/lib/reviewProofCard.ts @@ -0,0 +1,13 @@ +/** Compare wire-visible components, accounting for IDs and omitted button defaults. */ +export function normalizeProofCard(value: unknown): unknown { + if (Array.isArray(value)) return value.map(normalizeProofCard) + if (value && typeof value === "object") { + const component = value as { type?: unknown } + return Object.fromEntries(Object.entries(value) + .filter(([key, item]) => key !== "id" && item !== undefined && + // Discord omits false on enabled buttons; true remains observable. + !(component.type === 2 && key === "disabled" && item === false)) + .map(([key, item]) => [key, normalizeProofCard(item)])) + } + return value +} diff --git a/scripts/lib/reviewProofFixture.ts b/scripts/lib/reviewProofFixture.ts new file mode 100644 index 0000000..5055f06 --- /dev/null +++ b/scripts/lib/reviewProofFixture.ts @@ -0,0 +1,64 @@ +export interface ReviewProofFixtureInput { + guildId: string + channelId: string + targetUserId: string + nowMs: number +} + +export interface ReviewProofFixtureMessage { + id: string + guild_id: string + channel_id: string + author: { id: string; username: string } + content: string + timestamp: string + message_reference?: { message_id: string } +} + +/** Synthetic export only: this function performs no I/O and sends no messages. + * IDs prefixed with synthetic-review are fixture identities, not Discord receipts. + * The deliberately strong signals exercise plumbing, not detector accuracy. + */ +export function buildReviewProofFixture({ + guildId, + channelId, + targetUserId, + nowMs +}: ReviewProofFixtureInput): { messages: ReviewProofFixtureMessage[] } { + if (!guildId || !channelId || !targetUserId || !Number.isSafeInteger(nowMs)) { + throw new Error("Synthetic review fixture requires IDs and a safe integer timestamp") + } + + const messages: ReviewProofFixtureMessage[] = [] + for (let index = 0; index < 24; index++) { + const parentId = `synthetic-review-parent-${index}` + const parentTime = nowMs - (24 - index) * 120_000 + messages.push({ + id: parentId, + guild_id: guildId, + channel_id: channelId, + author: { + id: `synthetic-review-parent-author-${targetUserId}`, + username: "synthetic-review-parent" + }, + content: `Synthetic fixture request ${index}: describe the numbered sample.`, + timestamp: new Date(parentTime).toISOString() + }) + messages.push({ + id: `synthetic-review-reply-${index}`, + guild_id: guildId, + channel_id: channelId, + author: { id: targetUserId, username: "synthetic-review-target" }, + content: [ + `Synthetic fixture response ${index}; no community message is represented.`, + "assistant to=functions.synthetic_fixture", + "1. **Observation** The numbered synthetic sample contains a bounded set of generated records.", + "2. **Validation** Each record is derived from a deterministic fixture and has a known timestamp.", + "3. **Result** This controlled sample exercises the review pipeline without observing a real member." + ].join("\n"), + timestamp: new Date(parentTime + 1_200).toISOString(), + message_reference: { message_id: parentId } + }) + } + return { messages } +} diff --git a/scripts/proof-review-interactions.ts b/scripts/proof-review-interactions.ts new file mode 100644 index 0000000..e72e6b6 --- /dev/null +++ b/scripts/proof-review-interactions.ts @@ -0,0 +1,152 @@ +/** Opt-in actual Discord Gateway command/button ingress; never deployed. + * Own temporary test-guild command is removed in finally; operator owns test-role lifecycle. + * Local D1, synthetic Discrawl, unchanged Carbon router/ReviewCommand/buttons. + */ +import assert from "node:assert/strict" +import { randomUUID } from "node:crypto" +import { execFileSync } from "node:child_process" +import { appendFile, mkdir, readdir, writeFile } from "node:fs/promises" +import { resolve } from "node:path" +import { readLiveProofConfig } from "./lib/reviewLiveProofConfig.js" +import { normalizeProofCard } from "./lib/reviewProofCard.js" + +assert.deepEqual(process.argv.slice(2), ["--live"], "Explicit --live required") +const config = readLiveProofConfig(process.env) +const actors = (process.env.HERMIT_PROOF_ACTOR_IDS || "").split(",") +assert(actors.length > 0 && actors.every(id => /^[1-9][0-9]{16,19}$/.test(id))) +// Provider proof is separate; never spend/infer silently in this ingress run. +assert(!process.env.OPENAI_API_KEY, "Use separate provider proof; no key in ingress process") +const repo = resolve(import.meta.dir, "..") +const head = execFileSync("git", ["-C", repo, "rev-parse", "HEAD"], { encoding:"utf8" }).trim() +assert.equal(execFileSync("git", ["-C", repo, "status", "--porcelain"], { encoding:"utf8" }).trim(), "") +const root = resolve(process.env.XDG_STATE_HOME || resolve(process.env.HOME!, ".local/state"), "hermit-interaction-proof", randomUUID()) +await mkdir(root, {recursive:true,mode:0o700}) +const emit = async (event:string, detail:Record={}) => { + await appendFile(resolve(root,"evidence.jsonl"), JSON.stringify({at:new Date().toISOString(),head,event,...detail})+"\n",{mode:0o600}) + console.log(event) +} +console.warn = () => { console.log("Service warning (details suppressed)") } +console.error = () => { console.log("Service error (details suppressed)") } +const {Client,Routes,InteractionCreateListener,serializePayload} = await import("@buape/carbon") +const {GatewayPlugin} = await import("@buape/carbon/gateway") +const {getPlatformProxy} = await import("wrangler") +const {reviewConfig} = await import("../src/config/review.js") +const {setRuntimeEnv} = await import("../src/runtime/env.js") +const data = await import("../src/data/review.js") +const {postReviewEscalationCard} = await import("../src/services/reviewNotifier.js") +const {reviewComponents,buildReviewCardContainer} = await import("../src/components/reviewButtons.js") +const {default:ReviewCommand} = await import("../src/commands/review.js") +const {buildReviewProofFixture} = await import("./lib/reviewProofFixture.js") +const {applyReviewMigrations} = await import("./lib/reviewMigrationProof.js") +const {startDiscrawlServer} = await import("../forwarder/src/discrawlServer.js") +let cleanupD1: (()=>Promise)|undefined, stopBridge: (()=>void)|undefined +const roleId=process.env.HERMIT_PROOF_STAFF_ROLE_ID +assert(roleId && /^[1-9][0-9]{16,19}$/.test(roleId),"Supply externally managed zero-permission test role") +let commandId:string|undefined, timer: ReturnType|undefined +let stage=0, actor:string|undefined, staleMessageId:string|undefined, sharedId:string|undefined +let resolveDone!:()=>void, rejectDone!:(error:unknown)=>void +const done=new Promise((resolve,reject)=>{resolveDone=resolve;rejectDone=reject}) +const caseId=`case-${config.guildId}-${config.botId}` +const command=new ReviewCommand() +let client:InstanceType +class ProofListener extends InteractionCreateListener { + async handle(raw:any) { + if(raw.guild_id!==config.guildId || raw.channel_id!==config.channelId || !actors.includes(raw.member?.user?.id)) return + if(raw.type===2 && raw.data?.name!=="review") return + if(raw.type===3 && !raw.data?.custom_id?.startsWith("review-")) return + if(![2,3].includes(raw.type)) return + try { + if(actor) assert.equal(raw.member.user.id,actor) + if(raw.type===2) { + assert([0,1].includes(stage),"Unexpected command stage") + assert.equal(raw.data.options?.find((x:any)=>x.name==="user")?.value,config.botId,"Only synthetic bot subject") + } else { + assert([2,3].includes(stage),"Unexpected component stage") + assert.equal(raw.message.id,stage===2?staleMessageId:sharedId) + assert(raw.data.custom_id.startsWith("review-dismiss:"),"Use Dismiss only") + } + const before=await data.getReviewCase(caseId) + // Unmodified real Gateway interaction, including actual role claims and token. + await client.handleInteraction(raw,{}) + const response:any=await client.rest.get(`/webhooks/${config.botId}/${raw.token}/messages/@original`) + const responseText=JSON.stringify(response.components) + if(stage===0) { + assert(!raw.member.roles.includes(roleId)) + assert(responseText.includes("Staff role required")); assert.equal(await data.getReviewCase(caseId),null) + actor=raw.member.user.id + await emit("real_nonstaff_command_rejected",{caseCreated:false}) + stage=1;await emit("awaiting_external_test_role_assignment_then_authorized_review_command") + } else if(stage===1) { + assert(raw.member.roles.includes(roleId)) + let current=await data.getReviewCase(caseId);assert(current?.status==="escalated") + assert(responseText.includes("review-dismiss:"));staleMessageId=response.id + await emit("real_staff_command_case_verified",{revision:current.cardRevision,status:current.status}) + await postReviewEscalationCard(client,current) + current=await data.getReviewCase(caseId);assert(current?.reviewMessageId);sharedId=current.reviewMessageId + stage=2;await emit("awaiting_stale_ephemeral_dismiss",{sharedRevision:current.cardRevision}) + } else if(stage===2) { + assert(responseText.includes("Review case changed")) + const current=await data.getReviewCase(caseId) + assert.equal(current?.status,"escalated");assert.equal(current?.cardRevision,before?.cardRevision) + await emit("real_stale_button_rejected",{decisionUnchanged:true}) + stage=3;await emit("awaiting_current_shared_dismiss") + } else { + const current=await data.getReviewCase(caseId);assert(current?.reviewMessageId) + assert.equal(current.status,"dismissed");assert.equal(current.decidedById,actor) + assert.equal(current.cardRevision,current.syncedCardRevision) + const card:any=await client.rest.get(Routes.channelMessage(config.channelId,current.reviewMessageId)) + const expected=serializePayload({components:[buildReviewCardContainer(current,true)],allowedMentions:{parse:[]}}) + assert.deepEqual(normalizeProofCard(card.components),normalizeProofCard(expected.components)) + assert(!JSON.stringify(card.components).includes("review-dismiss:")) + await emit("real_staff_button_decision_and_card_verified",{status:current.status,desired:current.cardRevision,synced:current.syncedCardRevision,buttonsRemoved:true}) + stage=4;resolveDone() + } + } catch(error) {rejectDone(error)} + } +} +client=new Client({clientId:config.botId,token:config.token,publicKey:"0".repeat(64),baseUrl:"http://127.0.0.1",disableDeployRoute:true,autoDeploy:false,requestOptions:{queueRequests:false}}, {commands:[command],components:reviewComponents,listeners:[new ProofListener()]}) +const gateway=new GatewayPlugin({intents:0,autoInteractions:false,eventFilter:(type:string)=>type==="INTERACTION_CREATE"||type==="READY"}) +gateway.emitter.on("error",()=>{console.log("Gateway error; details suppressed")}) +try { + const bot:any=await client.rest.get("/users/@me");assert.equal(bot.id,config.botId);assert(bot.bot) + const app:any=await client.rest.get("/oauth2/applications/@me");assert(!app.interactions_endpoint_url,"Do not divert existing endpoint") + const channel:any=await client.rest.get(Routes.channel(config.channelId));assert.equal(channel.guild_id,config.guildId);assert.equal(channel.type,0) + const messages:any=await client.rest.get(Routes.channelMessages(config.channelId),{limit:1});assert.equal(messages.length,0) + const commandRoute=`/applications/${config.botId}/guilds/${config.guildId}/commands` + const commands:any=await client.rest.get(commandRoute);assert(!commands.some((c:any)=>c.name==="review"),"Never replace an existing command") + const globalCommands:any=await client.rest.get(`/applications/${config.botId}/commands`);assert(!globalCommands.some((c:any)=>c.name==="review"),"Never shadow an existing global command") + await emit("started",{database:"local Wrangler D1",transport:"actual Discord Gateway interaction -> unchanged Carbon router -> production command/buttons -> real callback/GET",providerExercised:false,limits:["No deployed Worker","No provider request","Test process guild/channel/staff role overrides"]}) + const wranglerPath=resolve(root,"wrangler.json") + await writeFile(wranglerPath,JSON.stringify({name:"hermit-interaction-proof",compatibility_date:"2026-09-08",compatibility_flags:["nodejs_compat"],d1_databases:[{binding:"DB",database_name:"isolated-proof",database_id:"00000000-0000-0000-0000-000000000001"}]})) + const proxy=await getPlatformProxy<{DB:D1Database}>({configPath:wranglerPath,envFiles:[],remoteBindings:false,persist:{path:resolve(root,"d1")}}) + cleanupD1=()=>proxy.dispose();setRuntimeEnv({DB:proxy.env.DB} as Env) + const migrations=resolve(repo,"drizzle");await applyReviewMigrations(proxy.env.DB,migrations,(await readdir(migrations)).filter(f=>f.endsWith(".sql")).sort()) + const fixturePath=resolve(root,"synthetic-export.json") + await writeFile(fixturePath,JSON.stringify(buildReviewProofFixture({guildId:config.guildId,channelId:config.channelId,targetUserId:config.botId,nowMs:Date.now()})),{mode:0o600}) + const secret=randomUUID()+randomUUID();const bridge=startDiscrawlServer({exportPath:fixturePath,secret,port:0});stopBridge=()=>bridge.stop(true) + delete process.env.DISCRAWL_EXPORT_PATH;process.env.DISCRAWL_EXPORT_URL=`http://127.0.0.1:${bridge.port}`;process.env.DISCRAWL_SECRET=secret;process.env.ENABLE_AUTOMATIC_SCREENING="false" + const roles:any=await client.rest.get(`/guilds/${config.guildId}/roles`) + const role=roles.find((entry:any)=>entry.id===roleId);assert(role && String(role.permissions)==="0","Test role must exist with zero permissions") + Object.assign(reviewConfig,{guildId:config.guildId,reviewChannelId:config.channelId,staffRoleIds:[roleId]}) + const registered:any=await client.rest.post(commandRoute,{body:command.serialize()});commandId=registered.id + await gateway.registerClient(client) + timer=setTimeout(()=>rejectDone(new Error("Interaction proof timed out")),15*60_000) + await emit("awaiting_nonstaff_review_command") + await done + await emit("passed",{actualCommands:2,actualButtons:2,realPermissionRejection:true,realStaleRejection:true}) +} catch(error) { + await emit("failed",{stage,errorType:error instanceof Error?error.name:"unknown",status:typeof (error as any)?.status==="number"?(error as any).status:null,code:typeof (error as any)?.code==="number"?(error as any).code:null}) + process.exitCode=1 +} finally { + if(timer)clearTimeout(timer) + gateway.disconnect() + let cleanupFailed=false + if(commandId)try{await client.rest.delete(`/applications/${config.botId}/guilds/${config.guildId}/commands/${commandId}`)}catch{cleanupFailed=true} + stopBridge?.();await cleanupD1?.() + await emit("cleanup",{temporaryCommandRemoved:!cleanupFailed,externalTestRoleCleanupRequired:true}) + if(cleanupFailed)process.exitCode=1 + console.log(`Private evidence retained at ${root}`) +} +// Carbon's internal timers can outlive the disconnected proof client. All +// owned resources and evidence writes have completed above. +process.exit(process.exitCode ? Number(process.exitCode) : 0) diff --git a/scripts/proof-review-live.ts b/scripts/proof-review-live.ts new file mode 100644 index 0000000..d384e4b --- /dev/null +++ b/scripts/proof-review-live.ts @@ -0,0 +1,255 @@ +/** + * Opt-in real Discord transport proof. Never loaded by the deployed Worker. + * D1 is an isolated LOCAL Wrangler binding, not deployed Cloudflare D1. + * This does not prove Discord slash-command ingress or a real Worker termination. + * Run --preflight first. --live writes one test card; --provider also spends API credit. + * Supply secrets through the environment, never command-line flags. + */ +import assert from "node:assert/strict" +import { createHash, randomUUID } from "node:crypto" +import { appendFile, mkdir, readFile, readdir, writeFile } from "node:fs/promises" +import { resolve } from "node:path" +import { execFileSync } from "node:child_process" +import { readLiveProofConfig } from "./lib/reviewLiveProofConfig.js" +import { normalizeProofCard as normalize } from "./lib/reviewProofCard.js" + +const args = new Set(process.argv.slice(2)) +for (const arg of args) { + if (!["--preflight", "--live", "--provider"].includes(arg)) throw new Error("Unknown proof option") +} +if (args.has("--live") === args.has("--preflight")) { + throw new Error("Choose exactly one of --preflight (offline) or --live (external writes)") +} +const config = readLiveProofConfig(process.env) +if (args.has("--provider") && !process.env.OPENAI_API_KEY) throw new Error("Missing OPENAI_API_KEY") +if (args.has("--preflight")) { + console.log("Offline configuration preflight passed. No credentials verified, no network or proof performed.") + process.exit(0) +} + +const repo = resolve(import.meta.dir, "..") +const head = execFileSync("git", ["-C", repo, "rev-parse", "HEAD"], { encoding: "utf8" }).trim() +const dirty = execFileSync("git", ["-C", repo, "status", "--porcelain"], { encoding: "utf8" }).trim() +assert.equal(dirty, "", "Commit the exact proof harness and tree before a live run") +const runId = randomUUID() +const root = resolve(process.env.XDG_STATE_HOME || resolve(process.env.HOME!, ".local/state"), "hermit-live-proof", runId) +await mkdir(root, { recursive: true, mode: 0o700 }) +const evidencePath = resolve(root, "evidence.jsonl") +const emit = async (event: string, detail: Record = {}) => { + const record = { at: new Date().toISOString(), runId, head, event, ...detail } + await appendFile(evidencePath, JSON.stringify(record) + "\n", { mode: 0o600 }) + console.log(event) +} +await emit("started", { + claim: "Real Discord delayed PATCH convergence through production notifier and recovery services", + transport: "Carbon REST to discord.com; one PATCH held then delivered, caller acknowledgment withheld", + database: "isolated local Wrangler D1 binding", + configuration: "test guild/channel substituted in harness only; production configuration untouched", + providerRequested: args.has("--provider"), + limits: ["No deployed Worker/D1", "No Discord command/button ingress", "No actual Worker kill", "No red baseline"] +}) + +// Do not let production-service diagnostics print provider response bodies or identifiers. +const savedWarn = console.warn +const savedError = console.error +console.warn = () => { console.log("Production service warning (response body suppressed)") } +console.error = () => { console.log("Production service error (response body suppressed)") } +const savedFetch = globalThis.fetch +let dispose: (() => Promise) | undefined +let stopBridge: (() => void) | undefined +let phase = "setup" + +try { + const { Client, Routes } = await import("@buape/carbon") + const { getPlatformProxy } = await import("wrangler") + const { reviewConfig } = await import("../src/config/review.js") + const { setRuntimeEnv } = await import("../src/runtime/env.js") + const data = await import("../src/data/review.js") + const service = await import("../src/services/reviewNotifier.js") + const { buildReviewCardContainer } = await import("../src/components/reviewButtons.js") + const { serializePayload } = await import("@buape/carbon") + const { analyze } = await import("../src/review/analyzer.js") + const { buildReviewProofFixture } = await import("./lib/reviewProofFixture.js") + const { applyReviewMigrations } = await import("./lib/reviewMigrationProof.js") + const { startDiscrawlServer } = await import("../forwarder/src/discrawlServer.js") + // This process has no inbound Discord listeners and never deploys commands. + const client = new Client({ + clientId: config.botId, token: config.token, + publicKey: "0".repeat(64), disableDeployRoute: true, + baseUrl: "http://127.0.0.1", autoDeploy: false, + requestOptions: { queueRequests: false } + }, { commands: [] }) + Object.assign(reviewConfig, { guildId: config.guildId, reviewChannelId: config.channelId }) + process.env.ENABLE_AUTOMATIC_SCREENING = "false" + + phase = "read-only Discord scope verification" + const bot = await client.rest.get("/users/@me") as { id: string; bot: boolean } + assert.equal(bot.id, config.botId) + assert.equal(bot.bot, true) + const channel = await client.rest.get(Routes.channel(config.channelId)) as { id: string; guild_id: string; type: number } + assert.equal(channel.id, config.channelId) + assert.equal(channel.guild_id, config.guildId) + assert.equal(channel.type, 0, "Use a dedicated test text channel") + const history = await client.rest.get(Routes.channelMessages(config.channelId), { limit: 1 }) + assert(Array.isArray(history) && history.length === 0, "Use an empty dedicated proof channel; no unrelated history is inspected") + await emit("test_scope_verified") + + phase = "isolated local D1 and authenticated fixture bridge" + const configPath = resolve(root, "wrangler.json") + await writeFile(configPath, JSON.stringify({ + name: "hermit-local-live-transport-proof", compatibility_date: "2026-09-08", + compatibility_flags: ["nodejs_compat"], + d1_databases: [{ binding: "DB", database_name: "isolated-proof", database_id: "00000000-0000-0000-0000-000000000001" }] + }), { mode: 0o600 }) + const proxy = await getPlatformProxy<{ DB: D1Database }>({ configPath, envFiles: [], remoteBindings: false, persist: { path: resolve(root, "d1") } }) + dispose = () => proxy.dispose() + setRuntimeEnv({ DB: proxy.env.DB } as Env) + const db = proxy.env.DB + const migrations = resolve(repo, "drizzle") + await applyReviewMigrations(db, migrations, (await readdir(migrations)).filter((file) => file.endsWith(".sql")).sort()) + const fixture = buildReviewProofFixture({ guildId: config.guildId, channelId: config.channelId, targetUserId: config.botId, nowMs: Date.now() }) + const fixturePath = resolve(root, "synthetic-export.json") + await writeFile(fixturePath, JSON.stringify(fixture), { mode: 0o600 }) + const secret = randomUUID() + randomUUID() + const bridge = startDiscrawlServer({ exportPath: fixturePath, secret, port: 0 }) + stopBridge = () => { bridge.stop(true) } + delete process.env.DISCRAWL_EXPORT_PATH + process.env.DISCRAWL_EXPORT_URL = `http://127.0.0.1:${bridge.port}` + process.env.DISCRAWL_SECRET = secret + const observations = await data.getRecentUserObservations(config.guildId, config.botId, 7, 100) + assert.equal(observations.length, 24) + const report = analyze({ guildId: config.guildId, authorId: config.botId, + startAt: Date.now() - 7 * 86400000, endAt: Date.now(), messages: observations, + scoreGate: { minMessages: 10, minSpanMs: 60000 } }) + assert.equal(report.priority, "review-recommended") + await emit("authenticated_discrawl_fixture_verified", { observations: observations.length, + families: Object.keys(report.familyScores), fixtureSha256: createHash("sha256").update(await readFile(fixturePath)).digest("hex") }) + + let assessment: Awaited> = null + if (args.has("--provider")) { + phase = "real provider assessment" + globalThis.fetch = (async (input, init) => { + const url = input instanceof Request ? input.url : String(input) + const response = await savedFetch(input, init) + if (url === "https://api.openai.com/v1/chat/completions") { + const body = await response.clone().json().catch(() => ({})) as { model?: string } + await emit("provider_response", { status: response.status, + returnedModel: typeof body.model === "string" ? body.model : null }) + } + return response + }) as typeof fetch + const { evaluateWithKrill } = await import("../src/review/krillEvaluator.js") + assessment = await evaluateWithKrill(report) + assert(assessment, "Real provider assessment failed; do not report provider proof") + assert(Number.isFinite(assessment.automationProbability)) + await emit("provider_assessment_verified", { requestedModel: assessment.model, + probability: assessment.automationProbability, + briefSha256: createHash("sha256").update(assessment.brief).digest("hex") }) + globalThis.fetch = savedFetch + } + + phase = "real card create and preservation control" + const caseId = `proof-${runId}` + let current = await data.createReviewCase({ + caseId, guildId: config.guildId, targetUserId: config.botId, status: "escalated", + heuristicScore: report.heuristicScore ?? 0, concordance: report.concordance, + behavioralFamilies: JSON.stringify(Object.keys(report.familyScores)), + keySignals: JSON.stringify(report.signals.slice(0, 3).map(({ code, family, description }) => ({ code, family, description }))), + krillBrief: assessment?.brief ?? "Synthetic real-transport proof; not a member assessment.", + krillModel: assessment?.model ?? null, + krillProbability: assessment ? `${(assessment.automationProbability * 100).toFixed(1)}%` : null, + reviewChannelId: config.channelId, deliveryStatus: "pending" + }) + assert(current) + await service.postReviewEscalationCard(client, current) + current = await data.getReviewCase(caseId) + assert(current?.reviewMessageId && current.deliveryStatus === "delivered") + const messageId = current.reviewMessageId + const route = Routes.channelMessage(config.channelId, messageId) + // Exact readback, not a PATCH count or success banner. Ignore Discord-generated component IDs. + const readCard = async () => { + const message = await client.rest.get(route) as { id: string; channel_id: string; author: { id: string; bot: boolean }; components: unknown } + assert.equal(message.id, messageId) + assert.equal(message.channel_id, config.channelId) + assert.equal(message.author.id, config.botId) + assert.equal(message.author.bot, true) + return normalize(message.components) + } + const expectedCard = (row: NonNullable) => normalize(serializePayload({ components: [buildReviewCardContainer(row, row.status !== "escalated")] }).components) + assert.deepEqual(await readCard(), expectedCard(current)) + await emit("real_card_create_verified", { messageId, caseId, desired: current.cardRevision, synced: current.syncedCardRevision }) + + // The barrier holds only the first stale PATCH. All other I/O uses real Carbon REST. + phase = "delayed write fault injection" + current = await data.createReviewCase({ ...current, heuristicScore: 61 }) + assert(current) + const patch = client.rest.patch.bind(client.rest) + let captured: Parameters | undefined + let captureReady!: () => void + const barrier = new Promise((resolve) => { captureReady = resolve }) + client.rest.patch = async (...parameters) => { + assert.equal(parameters[0], route, "Unexpected PATCH target") + captured = parameters + client.rest.patch = patch + captureReady() + // Intentionally no resolve/reject: neither the production catch nor ack runs. + return new Promise(() => {}) + } + const pendingOriginal = service.syncSharedReviewCard(client, current) + let timer: ReturnType | undefined + try { + await Promise.race([barrier, pendingOriginal.then(() => { throw new Error("Original write returned before capture") }), + new Promise((_, reject) => { timer = setTimeout(() => reject(new Error("PATCH capture timed out")), 20000) })]) + } finally { clearTimeout(timer) } + assert(captured) + const oldPayload = normalize((captured[1]?.body as { components: unknown }).components) + const attempt = await db.prepare("SELECT attempt_token FROM review_card_write_attempts WHERE case_id = ?").bind(caseId).first<{ attempt_token: string }>() + assert(attempt, "Production entry point failed to persist a write obligation before transport") + current = await data.createReviewCase({ ...current, heuristicScore: 94 }) + assert(current) + assert.equal(await service.syncSharedReviewCard(client, current), true) + current = await data.getReviewCase(caseId) + assert(current) + assert.deepEqual(await readCard(), expectedCard(current)) + await emit("newer_write_acknowledged", { desired: current.cardRevision, synced: current.syncedCardRevision }) + + const runDueRecovery = async () => { + const row = await db.prepare("SELECT next_attempt_at FROM review_card_write_attempts WHERE attempt_token = ?") + .bind(attempt.attempt_token).first<{ next_attempt_at: string }>() + assert(row, "Unknown original write was retired prematurely") + // Respect actual production backoff; no fabricated due timestamps or fake clock. + const waitMs = Math.max(0, Date.parse(row.next_attempt_at) - Date.now() + 100) + assert(waitMs <= 130000, "Unexpected recovery backoff") + if (waitMs) { await emit("waiting_for_production_backoff", { waitMs }); await Bun.sleep(waitMs) } + await service.recoverOutstandingReviewCardWrites(client) + const latest = await data.getReviewCase(caseId) + assert(latest) + assert.equal(latest.cardRevision, latest.syncedCardRevision) + assert.deepEqual(await readCard(), expectedCard(latest)) + assert(await db.prepare("SELECT attempt_token FROM review_card_write_attempts WHERE attempt_token = ?").bind(attempt.attempt_token).first()) + return latest + } + current = await runDueRecovery() + await emit("repair_before_delayed_original_verified", { desired: current.cardRevision, synced: current.syncedCardRevision }) + await patch(...captured) + assert.deepEqual(await readCard(), oldPayload) + assert.notDeepEqual(oldPayload, expectedCard(current)) + await emit("real_stale_discord_payload_observed_after_newer_ack") + current = await runDueRecovery() + await emit("real_discord_convergence_verified", { desired: current.cardRevision, synced: current.syncedCardRevision, originalObligationRetained: true }) + const finalHistory = await client.rest.get(Routes.channelMessages(config.channelId), { limit: 50 }) as { id: string }[] + assert.deepEqual(finalHistory.map((message) => message.id), [messageId], "Unexpected replacement or additional card") + await emit("passed", { noReplacementPost: true, providerExercised: Boolean(assessment), + retained: "Test card and private local D1/evidence retained; no automatic deletion", phase }) +} catch (error) { + await emit("failed", { phase, errorType: error instanceof Error ? error.name : "unknown", + message: "Run failed. No live-proof success is claimed; inspect private state before retrying." }) + process.exitCode = 1 +} finally { + globalThis.fetch = savedFetch + console.warn = savedWarn + console.error = savedError + stopBridge?.() + try { await dispose?.() } catch { process.exitCode = 1; await emit("cleanup_failed") } + console.log(`Private evidence retained at ${evidencePath}; inspect/redact before publication.`) +} diff --git a/scripts/proof-review-migrations.ts b/scripts/proof-review-migrations.ts new file mode 100644 index 0000000..952530e --- /dev/null +++ b/scripts/proof-review-migrations.ts @@ -0,0 +1,86 @@ +/** Isolated local D1 migration proof. No remote bindings or deployed services. */ +import assert from "node:assert/strict" +import { mkdir, rm, writeFile } from "node:fs/promises" +import { readdirSync } from "node:fs" +import { resolve } from "node:path" +import { getPlatformProxy } from "wrangler" +import { + applyReviewMigrations, + assertReviewSchema, + verifyPopulatedReviewUpgrade +} from "./lib/reviewMigrationProof.js" + +const proofRoot = resolve(`/tmp/hermit-review-migrations-${Date.now()}`) +const drizzleDir = resolve(import.meta.dir, "../drizzle") +const files = readdirSync(drizzleDir).filter((file) => file.endsWith(".sql")).sort() +const disposers: Array<() => Promise> = [] +let originalError: unknown + +await mkdir(proofRoot, { recursive: true }) + +try { + assert(files.length > 0, "No migrations found") + const freshRoot = resolve(proofRoot, "fresh-install") + await mkdir(freshRoot, { recursive: true }) + const configPath = resolve(freshRoot, "wrangler.json") + await writeFile(configPath, JSON.stringify({ + name: "hermit-review-fresh-migration-proof", + compatibility_date: "2026-09-08", + compatibility_flags: ["nodejs_compat"], + d1_databases: [{ + binding: "DB", + database_name: "hermit-review-fresh-proof", + database_id: "00000000-0000-0000-0000-000000000003" + }] + })) + const fresh = await getPlatformProxy<{ DB: D1Database }>({ + configPath, + envFiles: [], + remoteBindings: false, + persist: { path: resolve(freshRoot, "state") } + }) + let freshDisposed = false + const disposeFresh = async () => { + if (!freshDisposed) { + await fresh.dispose() + freshDisposed = true + } + } + disposers.push(disposeFresh) + await applyReviewMigrations(fresh.env.DB, drizzleDir, files) + await assertReviewSchema(fresh.env.DB) + console.log(`Fresh local D1 migration sequence verified through ${files.at(-1)}.`) + await disposeFresh() + + await verifyPopulatedReviewUpgrade( + drizzleDir, + files, + proofRoot, + (dispose) => disposers.push(dispose) + ) + console.log("Migration proof passed: fresh install, populated upgrade, and negative preservation control.") +} catch (error) { + originalError = error + throw error +} finally { + let cleanupError: unknown + const disposed = await Promise.allSettled(disposers.map((dispose) => dispose())) + const failures = disposed.filter((result) => result.status === "rejected") + if (failures.length > 0) { + cleanupError = new AggregateError( + failures.map((result) => result.reason), + "Local migration proof proxy disposal failed" + ) + } + if (!cleanupError) { + try { + await rm(proofRoot, { recursive: true, force: true }) + } catch (error) { + cleanupError = error + } + } + if (cleanupError) { + if (originalError) console.error("Migration proof cleanup also failed:", cleanupError) + else throw cleanupError + } +} diff --git a/scripts/proof-review-pipeline.ts b/scripts/proof-review-pipeline.ts new file mode 100644 index 0000000..1bafa86 --- /dev/null +++ b/scripts/proof-review-pipeline.ts @@ -0,0 +1,293 @@ +/** Local D1 binding checks with MOCKED Discord transport. Not staging/deployment evidence. + * Usage: bun scripts/proof-review-pipeline.ts + */ +import assert from "node:assert/strict" +import { assertReviewSchema, verifyPopulatedReviewUpgrade } from "./lib/reviewMigrationProof.js" +import { mkdir, readFile, writeFile, rm } from "node:fs/promises" +import { resolve } from "node:path" +import { readdirSync } from "node:fs" +import { getPlatformProxy } from "wrangler" +import { setRuntimeEnv } from "../src/runtime/env.js" +import { reviewConfig } from "../src/config/review.js" +import { + createReviewCase, + beginReviewCardWrite, + claimOutstandingReviewCardWrite, + getReviewCase, + recordReviewCaseDecision, + markReviewCardSynced, + markReviewCardStaleWrite, + getUndeliveredEscalations, + listOutstandingReviewReceipts, + listOutOfSyncCases +} from "../src/data/review.js" +import { + postReviewEscalationCard, + recoverOutstandingReviewCardWrites, + syncSharedReviewCard, + recoverSharedCardSync +} from "../src/services/reviewNotifier.js" + +const proofDir = resolve("/tmp/hermit-review-proof-" + Date.now()) +await mkdir(proofDir, { recursive: true }) + +console.log("=== LOCAL D1 BINDINGS + MOCKED DISCORD TRANSPORT ===") +console.log(`Proof Directory: ${proofDir}\n`) + +const disposers: Array<() => Promise> = [] +let originalError: unknown +const previousBotId = process.env.DISCORD_CLIENT_ID +process.env.DISCORD_CLIENT_ID = "900000000000000001" + +try { + // ------------------------------------------------------------- + // STEP 1: Fresh Local D1 Binding & Migration Verification + // ------------------------------------------------------------- + console.log("--- STEP 1: Fresh Local D1 Binding ---") + const configPath = resolve(proofDir, "wrangler.json") + await writeFile( + configPath, + JSON.stringify({ + name: "hermit-proof-d1", + compatibility_date: "2026-09-08", + compatibility_flags: ["nodejs_compat"], + d1_databases: [ + { + binding: "DB", + database_name: "hermit-proof-db", + database_id: "00000000-0000-0000-0000-000000000001" + } + ] + }) + ) + + const proxy = await getPlatformProxy<{ DB: D1Database }>({ + configPath, + envFiles: [], + remoteBindings: false, + persist: { path: resolve(proofDir, "d1-state") } + }) + + disposers.push(() => proxy.dispose()) + + setRuntimeEnv({ + DB: proxy.env.DB + }) + + // Read and apply all SQL migrations in order + const drizzleDir = resolve(import.meta.dir, "../drizzle") + const sqlFiles = readdirSync(drizzleDir) + .filter((f) => f.endsWith(".sql")) + .sort() + + console.log(`Applying ${sqlFiles.length} migrations to clean D1 instance...`) + for (const file of sqlFiles) { + const sqlContent = await readFile(resolve(drizzleDir, file), "utf8") + const statements = sqlContent + .split("--> statement-breakpoint") + .map((s) => s.trim()) + .filter(Boolean) + for (const statement of statements) { + await proxy.env.DB.prepare(statement).run() + } + } + + await assertReviewSchema(proxy.env.DB) + console.log(`Fresh local D1 schema verified through ${sqlFiles.at(-1)}.`) + + // A different database is migrated to 0012, seeded, snapshotted, THEN upgraded. + await verifyPopulatedReviewUpgrade(drizzleDir, sqlFiles, proofDir, (dispose) => disposers.push(dispose)) + + // ------------------------------------------------------------- + // STEP 3: Staff Review Creation & Card Delivery + // ------------------------------------------------------------- + console.log("\n--- STEP 3: Case Creation & Delivery ---") + const caseId = `case-${reviewConfig.guildId}-proof-target` + const created = await createReviewCase({ + caseId, + guildId: reviewConfig.guildId, + targetUserId: "900000000000000002", + status: "escalated", + heuristicScore: 92, + concordance: "High", + behavioralFamilies: JSON.stringify(["operational-artifact", "stylometry", "repetition"]), + keySignals: JSON.stringify([{ + code: "operational-markers", + family: "operational-artifact", + description: "Synthetic proof signal retained by the canonical renderer." + }]), + deliveryStatus: "pending" + }) + assert(created) + assert.equal(created.status, "escalated") + console.log(`Created synthetic case in local D1:`) + console.log(` Case ID: ${created?.caseId}`) + console.log(` Status: ${created?.status}`) + console.log(` Delivery Status: ${created?.deliveryStatus}`) + console.log(` Card Revision: ${created?.cardRevision}`) + + // Deliver escalation card + const deliveredMessageId = "900000000000000003" + let lastCard: unknown + let postCount = 0 + const mockDiscord = { + rest: { + get: async () => [], + post: async (_route: string, opts: any) => { + postCount++ + lastCard = opts.body + return { id: deliveredMessageId } + }, + patch: async (_route: string, opts: any) => { + lastCard = opts.body + return { id: deliveredMessageId } + } + } + } as any + + await postReviewEscalationCard(mockDiscord, created!) + const afterPost = await getReviewCase(caseId) + assert.equal(afterPost?.reviewMessageId, deliveredMessageId) + assert.equal(afterPost?.deliveryStatus, "delivered") + assert(afterPost?.deliveryNonce) + assert.equal(afterPost?.deliveryClaimToken, null) + assert.equal(afterPost?.cardRevision, afterPost?.syncedCardRevision) + assert.equal(postCount, 1) + assert(JSON.stringify(lastCard).includes("Key Detected Signals")) + assert(JSON.stringify(lastCard).includes("operational-markers")) + console.log(`Delivered card through MOCKED Discord transport:`) + console.log(` reviewMessageId: ${afterPost?.reviewMessageId}`) + console.log(` deliveryStatus: ${afterPost?.deliveryStatus}`) + console.log(` syncedCardRevision: ${afterPost?.syncedCardRevision}`) + + // ------------------------------------------------------------- + // STEP 4: Staff Decision (Watchlist 7d) & Monotonic Revisions + // ------------------------------------------------------------- + console.log("\n--- STEP 4: Staff Action & Monotonic Revision Persistence ---") + const expiresAt = new Date(Date.now() + 7 * 86400000).toISOString() + const decided = await recordReviewCaseDecision( + caseId, + reviewConfig.guildId, + afterPost!.cardRevision, + { + status: "watchlist", + expiresAt, + decidedById: "staff-operator-1", + decisionReason: "Observed automated timing; watchlisting 7d." + } + ) + assert(decided) + assert.equal(decided.status, "watchlist") + assert(decided.cardRevision > decided.syncedCardRevision) + console.log(`Staff decision atomically recorded before mocked Discord I/O:`) + console.log(` Status: ${decided?.status}`) + console.log(` ExpiresAt: ${decided?.expiresAt}`) + console.log(` Card Revision bumped to: ${decided?.cardRevision} (synced was ${decided?.syncedCardRevision})`) + + // Sync shared card to Discord + await syncSharedReviewCard(mockDiscord, decided!) + const afterSync = await getReviewCase(caseId) + assert(afterSync) + assert.equal(afterSync.syncedCardRevision, afterSync.cardRevision) + assert(JSON.stringify(lastCard).includes("WATCHLIST")) + console.log(`Shared card synced through MOCKED transport:`) + console.log(` syncedCardRevision: ${afterSync?.syncedCardRevision}`) + + // ------------------------------------------------------------- + // STEP 5: Stale Write Rejection & Automatic Repair + // ------------------------------------------------------------- + console.log("\n--- STEP 5: Stale Write Detection & Repair Scheduling ---") + // Simulate an older delayed sync for revision 1 completing after revision 2 + const staleAttempt = await markReviewCardSynced(caseId, 1) + assert.equal(staleAttempt, null) + console.log(`Delayed sync attempt for revision 1 result: ${staleAttempt ? "ACCEPTED" : "REJECTED (Correct)"}`) + + // Schedule repair on stale write + const repaired = await markReviewCardStaleWrite(caseId, 1) + assert(repaired && repaired.cardRevision > repaired.syncedCardRevision) + console.log(`markReviewCardStaleWrite allocated repair revision: ${repaired?.cardRevision}`) + const outOfSync = await listOutOfSyncCases( + reviewConfig.guildId, + reviewConfig.reviewChannelId, + 5 + ) + assert(outOfSync.some((item) => item.caseId === caseId)) + await recoverSharedCardSync(mockDiscord) + const recovered = await getReviewCase(caseId) + assert.equal(recovered?.cardRevision, recovered?.syncedCardRevision) + console.log(`Maintenance detected out-of-sync cases: ${outOfSync.length} case(s) queued for sync repair`) + + // ------------------------------------------------------------- + // STEP 6: Pending Priority and Uncertainty Backoff + // ------------------------------------------------------------- + console.log("\n--- STEP 6: Pending Priority and Uncertainty Backoff ---") + const now = Date.now() + await proxy.env.DB.prepare( + `INSERT INTO review_cases (case_id, guild_id, target_user_id, status, heuristic_score, concordance, behavioral_families, delivery_status, updated_at) + VALUES ('proof-unc-recent', '${reviewConfig.guildId}', 'u-1', 'escalated', 90, 'High', '[]', 'uncertain', '${new Date(now - 15_000).toISOString()}'), + ('proof-unc-old', '${reviewConfig.guildId}', 'u-2', 'escalated', 90, 'High', '[]', 'uncertain', '${new Date(now - 90_000).toISOString()}'), + ('proof-pending-new', '${reviewConfig.guildId}', 'u-3', 'escalated', 90, 'High', '[]', 'pending', '${new Date(now - 5_000).toISOString()}')` + ).run() + + const escalations = await getUndeliveredEscalations(reviewConfig.guildId, 10) + const ids = escalations.map((e) => e.caseId) + console.log("New-delivery candidate ordering:") + ids.forEach((id, idx) => console.log(` ${idx + 1}. ${id}`)) + assert.equal(ids[0], "proof-pending-new") + assert(!ids.includes("proof-unc-old")) + assert(!ids.includes("proof-unc-recent")) + const receiptCandidates = await listOutstandingReviewReceipts(reviewConfig.guildId, 10) + const receiptIds = receiptCandidates.map((item) => item.caseId) + assert(receiptIds.includes("proof-unc-old")) + assert(!receiptIds.includes("proof-unc-recent")) + console.log("Verified sendable-only delivery selection and separate uncertainty backoff.") + + // Exercise the actual D1 binding with an independently persisted unresolved + // write. Repeated repairs cannot establish that its original I/O finished. + const ledgerCase = await getReviewCase(caseId) + assert(ledgerCase) + const ledgerToken = "proof-unresolved-original-write" + await beginReviewCardWrite(ledgerCase, ledgerCase.cardRevision, ledgerToken, 0) + for (let pass = 0; pass < 3; pass++) { + await proxy.env.DB.prepare( + "UPDATE review_card_write_attempts SET next_attempt_at = NULL WHERE attempt_token = ?" + ).bind(ledgerToken).run() + await recoverOutstandingReviewCardWrites(mockDiscord) + const retained = await proxy.env.DB.prepare( + "SELECT claim_token, next_attempt_at, failure_count FROM review_card_write_attempts WHERE attempt_token = ?" + ).bind(ledgerToken).first<{ claim_token: string | null; next_attempt_at: string; failure_count: number }>() + assert(retained) + assert.equal(retained.claim_token, null) + assert.equal(retained.failure_count, 0) + assert(retained.next_attempt_at > new Date().toISOString()) + assert.equal(await claimOutstandingReviewCardWrite(ledgerToken, "stale-listed-worker"), null) + const repairedRow = await getReviewCase(caseId) + assert(repairedRow) + assert.equal(repairedRow.cardRevision, repairedRow.syncedCardRevision) + } + assert.equal(postCount, 1) + console.log("Local D1: three completed card repairs retained the unknown original write; stale due-time claims rejected; no additional POST.") + + console.log("\nLocal D1 / mocked transport assertions passed. No live Worker, Discord, or model-provider run was performed.") +} catch (error) { + originalError = error + throw error +} finally { + if (previousBotId === undefined) delete process.env.DISCORD_CLIENT_ID + else process.env.DISCORD_CLIENT_ID = previousBotId + let cleanupError: unknown + const disposed = await Promise.allSettled(disposers.map((dispose) => dispose())) + const failures = disposed.filter((result) => result.status === "rejected") + if (failures.length) { + cleanupError = new AggregateError(failures.map((result) => result.reason), "Local proxy disposal failed") + } + // Do not remove persistence beneath a still-running proxy. + if (!cleanupError) { + try { await rm(proofDir, { recursive: true, force: true }) } + catch (error) { cleanupError = error } + } + if (cleanupError) { + if (originalError) console.error("Proof cleanup also failed:", cleanupError) + else throw cleanupError + } +} diff --git a/src/commands/review.ts b/src/commands/review.ts new file mode 100644 index 0000000..03ef3a9 --- /dev/null +++ b/src/commands/review.ts @@ -0,0 +1,243 @@ +import { + ApplicationCommandOptionType, + ApplicationIntegrationType, + Button, + type CommandInteraction, + Container, + InteractionContextType, + Row, + Separator, + TextDisplay +} from "@buape/carbon" +import BaseCommand from "./base.js" +import { reviewConfig } from "../config/review.js" +import { + createReviewCase, + getRecentUserObservations, + getReviewCase +} from "../data/review.js" +import { analyze } from "../review/analyzer.js" +import { evaluateWithKrill } from "../review/krillEvaluator.js" +import { + ReviewConfirmBotButton, + ReviewDismissButton, + ReviewWatchlistButton +} from "../components/reviewButtons.js" + +const hasStaffRole = (interaction: CommandInteraction) => + interaction.member?.roles.some((role) => + (reviewConfig.staffRoleIds as readonly string[]).includes(role.id) + ) ?? false + +export default class ReviewCommand extends BaseCommand { + name = "review" + description = "Run automation & AI behavioral review on a user" + defer = true + ephemeral = true + contexts = [InteractionContextType.Guild] + integrationTypes = [ApplicationIntegrationType.GuildInstall] + + options = [ + { + type: ApplicationCommandOptionType.User as const, + name: "user", + description: "The user to evaluate", + required: true + }, + { + type: ApplicationCommandOptionType.Boolean as const, + name: "krill", + description: + "Request deep Krill evaluation using gpt-6-astra low-thinking", + required: false + } + ] + + async run(interaction: CommandInteraction) { + if (!hasStaffRole(interaction)) { + await interaction.reply({ + components: [ + new Container( + [ + new TextDisplay("### Staff role required"), + new TextDisplay( + "You need Community Team or Maintainer role to use this command." + ) + ], + { accentColor: "#f85149" } + ) + ], + ephemeral: true + }) + return + } + + const guildId = interaction.guild?.id + if (!guildId || guildId !== reviewConfig.guildId) { + await interaction.reply({ + components: [ + new Container( + [ + new TextDisplay("### Invalid server"), + new TextDisplay( + "This command is only enabled for the primary community server." + ) + ], + { accentColor: "#f85149" } + ) + ], + ephemeral: true + }) + return + } + + const targetUser = interaction.options.getUser("user", true) + const targetUserId = targetUser.id + const forceKrill = + interaction.options.getBoolean("krill", false) ?? false + + const observations = await getRecentUserObservations( + guildId, + targetUserId, + reviewConfig.windowDays, + reviewConfig.maxObservationsPerSample + ) + + if (observations.length === 0) { + await interaction.reply({ + components: [ + new Container( + [ + new TextDisplay("### 🦞 Claw & Order | Automation Review"), + new TextDisplay(`**Target:** <@${targetUserId}>`), + new TextDisplay( + `No messages observed for this user in the last ${reviewConfig.windowDays} days.` + ) + ], + { accentColor: "#8b949e" } + ) + ], + ephemeral: true + }) + return + } + + const now = Date.now() + const windowStart = now - reviewConfig.windowDays * 86400000 + const report = analyze({ + guildId, + authorId: targetUserId, + startAt: windowStart, + endAt: now, + messages: observations, + scoreGate: { minMessages: 10, minSpanMs: 60000 } + }) + + let krill = null + if (report.priority === "review-recommended" || forceKrill) { + krill = await evaluateWithKrill(report) + } + + const caseId = `case-${guildId}-${targetUserId}` + let reviewCase = await getReviewCase(caseId) + + const isWatchlistActive = + reviewCase?.status === "watchlist" && + reviewCase.expiresAt && + Date.parse(reviewCase.expiresAt) > Date.now() + + let targetStatus: string + if ( + reviewCase?.status === "dismissed" || + reviewCase?.status === "confirmed_bot" + ) { + targetStatus = reviewCase.status + } else if (isWatchlistActive) { + targetStatus = "watchlist" + } else if (report.priority === "review-recommended") { + targetStatus = "escalated" + } else { + targetStatus = reviewCase?.status || "open" + } + + if (report.priority === "review-recommended" || forceKrill || reviewCase) { + reviewCase = await createReviewCase({ + caseId, + guildId, + targetUserId, + status: targetStatus, + heuristicScore: report.heuristicScore ?? 0, + concordance: report.concordance, + behavioralFamilies: JSON.stringify(Object.keys(report.familyScores)), + keySignals: JSON.stringify(report.signals.slice(0, 3).map((signal) => ({ + code: signal.code, + family: signal.family, + description: signal.description + }))), + evidenceMessageId: observations[0]?.messageId, + krillProbability: krill + ? `${(krill.automationProbability * 100).toFixed(1)}%` + : reviewCase?.krillProbability ?? null, + krillBrief: krill?.brief ?? reviewCase?.krillBrief ?? null, + krillModel: krill?.model ?? reviewCase?.krillModel ?? null, + reviewChannelId: reviewConfig.reviewChannelId + }) + } + + const accentColor = + report.priority === "review-recommended" + ? "#f85149" + : report.priority === "some-indicators" + ? "#d29922" + : "#3fb950" + + const cardSections: (TextDisplay | Separator | Row