From 83b2bc2ddcc381c817ac0b9a61a52de17857bb2d Mon Sep 17 00:00:00 2001 From: Jiwon Kwon Date: Tue, 6 Oct 2026 18:06:59 +0900 Subject: [PATCH] Use snake_case database column names Map existing camelCase TypeScript properties to snake_case database columns and add a data-preserving rename migration. Update historical migration fixtures and index assertions for the renamed columns. Fixes #104. AI provenance: I asked Codex to implement issue #104. Codex generated the column mappings, rename migration and snapshot, and updates to existing tests. Assisted-by: Codex:gpt-6.1-sol --- .../migration.sql | 42 + .../snapshot.json | 3570 +++++++++++++++++ packages/models/src/login-migration.test.ts | 8 +- packages/models/src/outbox-migration.test.ts | 127 +- packages/models/src/resource.test.ts | 4 +- packages/models/src/schema.ts | 73 +- 6 files changed, 3722 insertions(+), 102 deletions(-) create mode 100644 packages/models/drizzle/20261006085045_snake_case_columns/migration.sql create mode 100644 packages/models/drizzle/20261006085045_snake_case_columns/snapshot.json diff --git a/packages/models/drizzle/20261006085045_snake_case_columns/migration.sql b/packages/models/drizzle/20261006085045_snake_case_columns/migration.sql new file mode 100644 index 0000000..a4b51ed --- /dev/null +++ b/packages/models/drizzle/20261006085045_snake_case_columns/migration.sql @@ -0,0 +1,42 @@ +ALTER TABLE "activities" RENAME COLUMN "actorId" TO "actor_id";--> statement-breakpoint +ALTER TABLE "activities" RENAME COLUMN "objectId" TO "object_id";--> statement-breakpoint +ALTER TABLE "actor_collection_references" RENAME COLUMN "actorId" TO "actor_id";--> statement-breakpoint +ALTER TABLE "actor_collection_references" RENAME COLUMN "collectionId" TO "collection_id";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "localId" TO "local_id";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "instanceId" TO "instance_id";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "inboxUrl" TO "inbox_url";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "profileUrl" TO "profile_url";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "avatarUrl" TO "avatar_url";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "headerUrl" TO "header_url";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "bioHtml" TO "bio_html";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "automaticallyApprovesFollowers" TO "automatically_approves_followers";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "fieldHtmls" TO "field_htmls";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "suspendedUntil" TO "suspended_until";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "successorId" TO "successor_id";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "followingCount" TO "following_count";--> statement-breakpoint +ALTER TABLE "actors" RENAME COLUMN "followersCount" TO "followers_count";--> statement-breakpoint +ALTER TABLE "addressing" RENAME COLUMN "sourceId" TO "source_id";--> statement-breakpoint +ALTER TABLE "addressing" RENAME COLUMN "targetId" TO "target_id";--> statement-breakpoint +ALTER TABLE "collection_items" RENAME COLUMN "collectionId" TO "collection_id";--> statement-breakpoint +ALTER TABLE "collection_items" RENAME COLUMN "itemId" TO "item_id";--> statement-breakpoint +ALTER TABLE "collections" RENAME COLUMN "ownerActorId" TO "owner_actor_id";--> statement-breakpoint +ALTER TABLE "collections" RENAME COLUMN "totalItems" TO "total_items";--> statement-breakpoint +ALTER TABLE "instance_members" RENAME COLUMN "accountId" TO "account_id";--> statement-breakpoint +ALTER TABLE "instance_members" RENAME COLUMN "instanceId" TO "instance_id";--> statement-breakpoint +ALTER TABLE "instances" RENAME COLUMN "localId" TO "local_id";--> statement-breakpoint +ALTER TABLE "instances" RENAME COLUMN "nodeInfoUrl" TO "node_info_url";--> statement-breakpoint +ALTER TABLE "instances" RENAME COLUMN "softwareVersion" TO "software_version";--> statement-breakpoint +ALTER TABLE "local_instances" RENAME COLUMN "maxActors" TO "max_actors";--> statement-breakpoint +ALTER TABLE "login_challenges" RENAME COLUMN "accountId" TO "account_id";--> statement-breakpoint +ALTER TABLE "objects" RENAME COLUMN "actorId" TO "actor_id";--> statement-breakpoint +ALTER TABLE "objects" RENAME COLUMN "contentHtml" TO "content_html";--> statement-breakpoint +ALTER TABLE "sessions" RENAME COLUMN "accountId" TO "account_id";--> statement-breakpoint +ALTER TABLE "sessions" RENAME COLUMN "tokenHash" TO "token_hash";--> statement-breakpoint +ALTER TABLE "actors" DROP CONSTRAINT "actors_suspended_check", ADD CONSTRAINT "actors_suspended_check" CHECK ( + "suspended_until" IS NULL OR ( + "suspended" IS NOT NULL AND + "suspended_until" > "suspended" + ) + );--> statement-breakpoint +ALTER TABLE "local_instances" DROP CONSTRAINT "instances_max_actors_check", ADD CONSTRAINT "instances_max_actors_check" CHECK ("max_actors" > 0);--> statement-breakpoint +ALTER TABLE "objects" DROP CONSTRAINT "objects_content_html_check", ADD CONSTRAINT "objects_content_html_check" CHECK (trim(both from "content_html") <> ''); diff --git a/packages/models/drizzle/20261006085045_snake_case_columns/snapshot.json b/packages/models/drizzle/20261006085045_snake_case_columns/snapshot.json new file mode 100644 index 0000000..d525923 --- /dev/null +++ b/packages/models/drizzle/20261006085045_snake_case_columns/snapshot.json @@ -0,0 +1,3570 @@ +{ + "version": "8", + "dialect": "postgres", + "id": "7b4b4a36-eeea-4c8c-a48f-4e4928939348", + "prevIds": ["4374c08e-0dd9-4aad-8046-5c984f4ece45"], + "ddl": [ + { + "values": ["inbound", "outbound"], + "name": "activity_delivery_direction", + "entityType": "enums", + "schema": "public" + }, + { + "values": [ + "received", + "acknowledged", + "unverified", + "rejected", + "queued", + "sent", + "failed", + "permanently_failed", + "abandoned" + ], + "name": "activity_delivery_status", + "entityType": "enums", + "schema": "public" + }, + { + "values": ["http_signature", "ld_signature", "object_integrity_proof"], + "name": "activity_delivery_verification_mechanism", + "entityType": "enums", + "schema": "public" + }, + { + "values": [ + "verified", + "invalid_signature", + "key_fetch_error", + "no_signature", + "unattempted", + "unobserved" + ], + "name": "activity_delivery_verification_result", + "entityType": "enums", + "schema": "public" + }, + { + "values": ["Create"], + "name": "activity_type", + "entityType": "enums", + "schema": "public" + }, + { + "values": ["Application", "Group", "Organization", "Person", "Service"], + "name": "actor_type", + "entityType": "enums", + "schema": "public" + }, + { + "values": ["to", "cc", "bto", "bcc", "audience"], + "name": "addressing_property", + "entityType": "enums", + "schema": "public" + }, + { + "values": ["followers", "following", "featured", "outbox"], + "name": "collection_role", + "entityType": "enums", + "schema": "public" + }, + { + "values": ["Collection", "OrderedCollection"], + "name": "collection_type", + "entityType": "enums", + "schema": "public" + }, + { + "values": ["Article", "Note"], + "name": "object_type", + "entityType": "enums", + "schema": "public" + }, + { + "values": ["actor", "object", "activity", "collection", "unknown"], + "name": "resource_kind", + "entityType": "enums", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "accounts", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "activities", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "activity_deliveries", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "activity_delivery_actor_collections", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "activity_delivery_actors", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "activity_delivery_attempts", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "actor_collection_references", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "actors", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "addressing", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "collection_items", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "collections", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "instance_members", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "instances", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "key_versions", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "keys", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "local_actors", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "local_instances", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "login_challenges", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "objects", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "resources", + "entityType": "tables", + "schema": "public" + }, + { + "isRlsEnabled": false, + "name": "sessions", + "entityType": "tables", + "schema": "public" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "accounts" + }, + { + "type": "varchar(255)", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "email", + "entityType": "columns", + "schema": "public", + "table": "accounts" + }, + { + "type": "varchar(100)", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "accounts" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "10", + "generated": null, + "identity": null, + "name": "max_instances", + "entityType": "columns", + "schema": "public", + "table": "accounts" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "admin", + "entityType": "columns", + "schema": "public", + "table": "accounts" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "accounts" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "activities" + }, + { + "type": "activity_type", + "typeSchema": "public", + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "activities" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "actor_id", + "entityType": "columns", + "schema": "public", + "table": "activities" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "object_id", + "entityType": "columns", + "schema": "public", + "table": "activities" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "published", + "entityType": "columns", + "schema": "public", + "table": "activities" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "document", + "entityType": "columns", + "schema": "public", + "table": "activities" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "activities" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "instance_id", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "actor_id", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "activity_delivery_direction", + "typeSchema": "public", + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "direction", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "activity_delivery_status", + "typeSchema": "public", + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "status", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "activity_delivery_verification_mechanism", + "typeSchema": "public", + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "verification_mechanism", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "activity_delivery_verification_result", + "typeSchema": "public", + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "verification_result", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 1, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "types", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "activity_iri", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "object_type", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "object_iri", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "signed_key_iri", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "verification_key_id", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "remote_actor_iri", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "remote_host", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "inbox_url", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "request_url", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "headers", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "bytea", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "body", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "status_code", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_body", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "payload", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 1, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "recipient_iris", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "completed", + "entityType": "columns", + "schema": "public", + "table": "activity_deliveries" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "delivery_id", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_actor_collections" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "actor_id", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_actor_collections" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "collection_iri", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_actor_collections" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "delivery_id", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "actor_id", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "inbox_owner", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "addressed", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "addressed_directly", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "sender", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "delivery_id", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "succeeded", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "status_code", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "response_body", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "error", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "actor_id", + "entityType": "columns", + "schema": "public", + "table": "actor_collection_references" + }, + { + "type": "collection_role", + "typeSchema": "public", + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "role", + "entityType": "columns", + "schema": "public", + "table": "actor_collection_references" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "collection_id", + "entityType": "columns", + "schema": "public", + "table": "actor_collection_references" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "local_id", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "actor_type", + "typeSchema": "public", + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "username", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "instance_id", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "document", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "inbox_url", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "profile_url", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avatar_url", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "header_url", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "bio_html", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "automatically_approves_followers", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "field_htmls", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "emojis", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "'{}'", + "generated": null, + "identity": null, + "name": "tags", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "sensitive", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "suspended", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "suspended_until", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "successor_id", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 1, + "default": "(ARRAY[]::text[])", + "generated": null, + "identity": null, + "name": "aliases", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "following_count", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "0", + "generated": null, + "identity": null, + "name": "followers_count", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "updated", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "published", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deleted", + "entityType": "columns", + "schema": "public", + "table": "actors" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "addressing" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "source_id", + "entityType": "columns", + "schema": "public", + "table": "addressing" + }, + { + "type": "addressing_property", + "typeSchema": "public", + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "property", + "entityType": "columns", + "schema": "public", + "table": "addressing" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "position", + "entityType": "columns", + "schema": "public", + "table": "addressing" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "target_id", + "entityType": "columns", + "schema": "public", + "table": "addressing" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "collection_id", + "entityType": "columns", + "schema": "public", + "table": "collection_items" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "item_id", + "entityType": "columns", + "schema": "public", + "table": "collection_items" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "position", + "entityType": "columns", + "schema": "public", + "table": "collection_items" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "observed", + "entityType": "columns", + "schema": "public", + "table": "collection_items" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "collections" + }, + { + "type": "collection_type", + "typeSchema": "public", + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "collections" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "owner_actor_id", + "entityType": "columns", + "schema": "public", + "table": "collections" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "total_items", + "entityType": "columns", + "schema": "public", + "table": "collections" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "document", + "entityType": "columns", + "schema": "public", + "table": "collections" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "updated", + "entityType": "columns", + "schema": "public", + "table": "collections" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account_id", + "entityType": "columns", + "schema": "public", + "table": "instance_members" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "instance_id", + "entityType": "columns", + "schema": "public", + "table": "instance_members" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "admin", + "entityType": "columns", + "schema": "public", + "table": "instance_members" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "accepted", + "entityType": "columns", + "schema": "public", + "table": "instance_members" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "instance_members" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "instances" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "local_id", + "entityType": "columns", + "schema": "public", + "table": "instances" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "instances" + }, + { + "type": "varchar(259)", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "host", + "entityType": "columns", + "schema": "public", + "table": "instances" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "node_info_url", + "entityType": "columns", + "schema": "public", + "table": "instances" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "software", + "entityType": "columns", + "schema": "public", + "table": "instances" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "software_version", + "entityType": "columns", + "schema": "public", + "table": "instances" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "key_versions" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "key_id", + "entityType": "columns", + "schema": "public", + "table": "key_versions" + }, + { + "type": "jsonb", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "public_key", + "entityType": "columns", + "schema": "public", + "table": "key_versions" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "fingerprint", + "entityType": "columns", + "schema": "public", + "table": "key_versions" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "first_seen", + "entityType": "columns", + "schema": "public", + "table": "key_versions" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "last_seen", + "entityType": "columns", + "schema": "public", + "table": "key_versions" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "keys" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "iri", + "entityType": "columns", + "schema": "public", + "table": "keys" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "keys" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "local_actors" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "avatar", + "entityType": "columns", + "schema": "public", + "table": "local_actors" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "header", + "entityType": "columns", + "schema": "public", + "table": "local_actors" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "local_instances" + }, + { + "type": "varchar(63)", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "slug", + "entityType": "columns", + "schema": "public", + "table": "local_instances" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "expires", + "entityType": "columns", + "schema": "public", + "table": "local_instances" + }, + { + "type": "integer", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "10", + "generated": null, + "identity": null, + "name": "max_actors", + "entityType": "columns", + "schema": "public", + "table": "local_instances" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "login_challenges" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account_id", + "entityType": "columns", + "schema": "public", + "table": "login_challenges" + }, + { + "type": "char(6)", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "code", + "entityType": "columns", + "schema": "public", + "table": "login_challenges" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "login_challenges" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP + INTERVAL '15 minutes'", + "generated": null, + "identity": null, + "name": "expires", + "entityType": "columns", + "schema": "public", + "table": "login_challenges" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "consumed", + "entityType": "columns", + "schema": "public", + "table": "login_challenges" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "actor_id", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "object_type", + "typeSchema": "public", + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "type", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "json", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "document", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "url", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "name", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "text", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "summary", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "content_html", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "varchar(35)", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "language", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "boolean", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "false", + "generated": null, + "identity": null, + "name": "sensitive", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "published", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "updated", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": false, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "deleted", + "entityType": "columns", + "schema": "public", + "table": "objects" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "text", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "iri", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "resource_kind", + "typeSchema": "public", + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "kind", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "resources" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "id", + "entityType": "columns", + "schema": "public", + "table": "sessions" + }, + { + "type": "uuid", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "account_id", + "entityType": "columns", + "schema": "public", + "table": "sessions" + }, + { + "type": "varchar(64)", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": null, + "generated": null, + "identity": null, + "name": "token_hash", + "entityType": "columns", + "schema": "public", + "table": "sessions" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP", + "generated": null, + "identity": null, + "name": "created", + "entityType": "columns", + "schema": "public", + "table": "sessions" + }, + { + "type": "timestamp with time zone", + "typeSchema": null, + "notNull": true, + "dimensions": 0, + "default": "CURRENT_TIMESTAMP + INTERVAL '1 month'", + "generated": null, + "identity": null, + "name": "expires", + "entityType": "columns", + "schema": "public", + "table": "sessions" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "actor_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "\"published\" desc", + "isExpression": true, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "\"id\" desc", + "isExpression": true, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "activity_actor_published_index", + "entityType": "indexes", + "schema": "public", + "table": "activities" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "object_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "published", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "activity_object_published_index", + "entityType": "indexes", + "schema": "public", + "table": "activities" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "instance_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "\"created\" desc", + "isExpression": true, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "\"id\" desc", + "isExpression": true, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "activity_delivery_instance_created_index", + "entityType": "indexes", + "schema": "public", + "table": "activity_deliveries" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "actor_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "activity_delivery_actor_index", + "entityType": "indexes", + "schema": "public", + "table": "activity_deliveries" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "verification_key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "activity_delivery_verification_key_index", + "entityType": "indexes", + "schema": "public", + "table": "activity_deliveries" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "activity_iri", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "inbox_url", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"direction\" = 'outbound'", + "with": "", + "method": "btree", + "concurrently": false, + "name": "activity_delivery_outbound_index", + "entityType": "indexes", + "schema": "public", + "table": "activity_deliveries" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "actor_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "\"created\" desc", + "isExpression": true, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "\"delivery_id\" desc", + "isExpression": true, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "activity_delivery_actor_created_index", + "entityType": "indexes", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "delivery_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "created", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "activity_delivery_attempt_delivery_index", + "entityType": "indexes", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "collection_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "actor_collection_reference_collection_index", + "entityType": "indexes", + "schema": "public", + "table": "actor_collection_references" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "instance_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "actor_instance_index", + "entityType": "indexes", + "schema": "public", + "table": "actors" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "target_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "property", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "addressing_target_property_index", + "entityType": "indexes", + "schema": "public", + "table": "addressing" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "collection_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "position", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "collection_item_position_index", + "entityType": "indexes", + "schema": "public", + "table": "collection_items" + }, + { + "nameExplicit": false, + "columns": [ + { + "value": "account_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"accepted\" IS NOT NULL", + "with": "", + "method": "btree", + "concurrently": false, + "name": "instance_members_accountId_index", + "entityType": "indexes", + "schema": "public", + "table": "instance_members" + }, + { + "nameExplicit": false, + "columns": [ + { + "value": "instance_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": "\"accepted\" IS NOT NULL", + "with": "", + "method": "btree", + "concurrently": false, + "name": "instance_members_instanceId_index", + "entityType": "indexes", + "schema": "public", + "table": "instance_members" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "key_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "first_seen", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "key_version_key_first_seen_index", + "entityType": "indexes", + "schema": "public", + "table": "key_versions" + }, + { + "nameExplicit": true, + "columns": [ + { + "value": "actor_id", + "isExpression": false, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "\"published\" desc", + "isExpression": true, + "asc": true, + "nullsFirst": false, + "opclass": null + }, + { + "value": "\"id\" desc", + "isExpression": true, + "asc": true, + "nullsFirst": false, + "opclass": null + } + ], + "isUnique": false, + "where": null, + "with": "", + "method": "btree", + "concurrently": false, + "name": "object_actor_published_index", + "entityType": "indexes", + "schema": "public", + "table": "objects" + }, + { + "nameExplicit": false, + "columns": ["id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "activities_id_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "activities" + }, + { + "nameExplicit": false, + "columns": ["actor_id"], + "schemaTo": "public", + "tableTo": "actors", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "activities_actorId_actors_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "activities" + }, + { + "nameExplicit": false, + "columns": ["object_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "activities_objectId_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "activities" + }, + { + "nameExplicit": false, + "columns": ["instance_id"], + "schemaTo": "public", + "tableTo": "instances", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "activity_deliveries_instance_id_instances_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "activity_deliveries" + }, + { + "nameExplicit": false, + "columns": ["actor_id"], + "schemaTo": "public", + "tableTo": "actors", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "name": "activity_deliveries_actor_id_actors_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "activity_deliveries" + }, + { + "nameExplicit": false, + "columns": ["verification_key_id"], + "schemaTo": "public", + "tableTo": "key_versions", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "RESTRICT", + "name": "activity_deliveries_verification_key_id_key_versions_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "activity_deliveries" + }, + { + "nameExplicit": true, + "columns": ["delivery_id", "actor_id"], + "schemaTo": "public", + "tableTo": "activity_delivery_actors", + "columnsTo": ["delivery_id", "actor_id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "activity_delivery_actor_collections_link_fkey", + "entityType": "fks", + "schema": "public", + "table": "activity_delivery_actor_collections" + }, + { + "nameExplicit": false, + "columns": ["delivery_id"], + "schemaTo": "public", + "tableTo": "activity_deliveries", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "activity_delivery_actors_eZEmaeqml3qX_fkey", + "entityType": "fks", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "nameExplicit": false, + "columns": ["actor_id"], + "schemaTo": "public", + "tableTo": "actors", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "activity_delivery_actors_actor_id_actors_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "nameExplicit": false, + "columns": ["delivery_id"], + "schemaTo": "public", + "tableTo": "activity_deliveries", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "activity_delivery_attempts_BJqYxUSnVaXX_fkey", + "entityType": "fks", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "nameExplicit": false, + "columns": ["actor_id"], + "schemaTo": "public", + "tableTo": "actors", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "actor_collection_references_actorId_actors_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "actor_collection_references" + }, + { + "nameExplicit": false, + "columns": ["collection_id"], + "schemaTo": "public", + "tableTo": "collections", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "actor_collection_references_collectionId_collections_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "actor_collection_references" + }, + { + "nameExplicit": false, + "columns": ["id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "actors_id_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "actors" + }, + { + "nameExplicit": false, + "columns": ["local_id"], + "schemaTo": "public", + "tableTo": "local_actors", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "actors_localId_local_actors_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "actors" + }, + { + "nameExplicit": false, + "columns": ["instance_id"], + "schemaTo": "public", + "tableTo": "instances", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "actors_instanceId_instances_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "actors" + }, + { + "nameExplicit": false, + "columns": ["successor_id"], + "schemaTo": "public", + "tableTo": "actors", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "SET NULL", + "name": "actors_successorId_actors_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "actors" + }, + { + "nameExplicit": false, + "columns": ["source_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "addressing_sourceId_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "addressing" + }, + { + "nameExplicit": false, + "columns": ["target_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "RESTRICT", + "name": "addressing_targetId_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "addressing" + }, + { + "nameExplicit": false, + "columns": ["collection_id"], + "schemaTo": "public", + "tableTo": "collections", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "collection_items_collectionId_collections_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "collection_items" + }, + { + "nameExplicit": false, + "columns": ["item_id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "collection_items_itemId_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "collection_items" + }, + { + "nameExplicit": false, + "columns": ["id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "collections_id_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "collections" + }, + { + "nameExplicit": false, + "columns": ["owner_actor_id"], + "schemaTo": "public", + "tableTo": "actors", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "collections_ownerActorId_actors_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "collections" + }, + { + "nameExplicit": false, + "columns": ["account_id"], + "schemaTo": "public", + "tableTo": "accounts", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "name": "instance_members_accountId_accounts_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "instance_members" + }, + { + "nameExplicit": false, + "columns": ["instance_id"], + "schemaTo": "public", + "tableTo": "instances", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "NO ACTION", + "name": "instance_members_instanceId_instances_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "instance_members" + }, + { + "nameExplicit": false, + "columns": ["local_id"], + "schemaTo": "public", + "tableTo": "local_instances", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "instances_localId_local_instances_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "instances" + }, + { + "nameExplicit": false, + "columns": ["key_id"], + "schemaTo": "public", + "tableTo": "keys", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "RESTRICT", + "name": "key_versions_key_id_keys_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "key_versions" + }, + { + "nameExplicit": false, + "columns": ["account_id"], + "schemaTo": "public", + "tableTo": "accounts", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "login_tokens_accountId_accounts_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "login_challenges" + }, + { + "nameExplicit": false, + "columns": ["id"], + "schemaTo": "public", + "tableTo": "resources", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "objects_id_resources_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "objects" + }, + { + "nameExplicit": false, + "columns": ["actor_id"], + "schemaTo": "public", + "tableTo": "actors", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "objects_actorId_actors_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "objects" + }, + { + "nameExplicit": false, + "columns": ["account_id"], + "schemaTo": "public", + "tableTo": "accounts", + "columnsTo": ["id"], + "onUpdate": "NO ACTION", + "onDelete": "CASCADE", + "name": "sessions_accountId_accounts_id_fkey", + "entityType": "fks", + "schema": "public", + "table": "sessions" + }, + { + "columns": ["delivery_id", "actor_id", "collection_iri"], + "nameExplicit": false, + "name": "activity_delivery_actor_collections_pkey", + "entityType": "pks", + "schema": "public", + "table": "activity_delivery_actor_collections" + }, + { + "columns": ["delivery_id", "actor_id"], + "nameExplicit": false, + "name": "activity_delivery_actors_pkey", + "entityType": "pks", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "columns": ["actor_id", "role"], + "nameExplicit": false, + "name": "actor_collection_references_pkey", + "entityType": "pks", + "schema": "public", + "table": "actor_collection_references" + }, + { + "columns": ["collection_id", "item_id"], + "nameExplicit": false, + "name": "collection_items_pkey", + "entityType": "pks", + "schema": "public", + "table": "collection_items" + }, + { + "columns": ["instance_id", "account_id"], + "nameExplicit": false, + "name": "instance_members_pkey", + "entityType": "pks", + "schema": "public", + "table": "instance_members" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "accounts_pkey", + "schema": "public", + "table": "accounts", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "activities_pkey", + "schema": "public", + "table": "activities", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "activity_deliveries_pkey", + "schema": "public", + "table": "activity_deliveries", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "activity_delivery_attempts_pkey", + "schema": "public", + "table": "activity_delivery_attempts", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "actors_pkey", + "schema": "public", + "table": "actors", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "addressing_pkey", + "schema": "public", + "table": "addressing", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "collections_pkey", + "schema": "public", + "table": "collections", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "instances_pkey", + "schema": "public", + "table": "instances", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "key_versions_pkey", + "schema": "public", + "table": "key_versions", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "keys_pkey", + "schema": "public", + "table": "keys", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "local_actors_pkey", + "schema": "public", + "table": "local_actors", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "local_instances_pkey", + "schema": "public", + "table": "local_instances", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "login_tokens_pkey", + "schema": "public", + "table": "login_challenges", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "objects_pkey", + "schema": "public", + "table": "objects", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "resources_pkey", + "schema": "public", + "table": "resources", + "entityType": "pks" + }, + { + "columns": ["id"], + "nameExplicit": false, + "name": "sessions_pkey", + "schema": "public", + "table": "sessions", + "entityType": "pks" + }, + { + "nameExplicit": true, + "columns": ["username", "instance_id"], + "nullsNotDistinct": false, + "name": "username_key", + "entityType": "uniques", + "schema": "public", + "table": "actors" + }, + { + "nameExplicit": true, + "columns": ["source_id", "property", "position"], + "nullsNotDistinct": false, + "name": "addressing_source_property_position_key", + "entityType": "uniques", + "schema": "public", + "table": "addressing" + }, + { + "nameExplicit": true, + "columns": ["key_id", "fingerprint"], + "nullsNotDistinct": false, + "name": "key_versions_key_id_fingerprint_unique", + "entityType": "uniques", + "schema": "public", + "table": "key_versions" + }, + { + "nameExplicit": false, + "columns": ["email"], + "nullsNotDistinct": false, + "name": "accounts_email_key", + "schema": "public", + "table": "accounts", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["local_id"], + "nullsNotDistinct": false, + "name": "actors_localId_key", + "schema": "public", + "table": "actors", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["host"], + "nullsNotDistinct": false, + "name": "instances_host_key", + "schema": "public", + "table": "instances", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["iri"], + "nullsNotDistinct": false, + "name": "keys_iri_key", + "schema": "public", + "table": "keys", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["slug"], + "nullsNotDistinct": false, + "name": "local_instances_slug_key", + "schema": "public", + "table": "local_instances", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["iri"], + "nullsNotDistinct": false, + "name": "resources_iri_key", + "schema": "public", + "table": "resources", + "entityType": "uniques" + }, + { + "nameExplicit": false, + "columns": ["token_hash"], + "nullsNotDistinct": false, + "name": "sessions_tokenHash_key", + "schema": "public", + "table": "sessions", + "entityType": "uniques" + }, + { + "value": "\"email\" ~ '^[^@]+@[^@]+\\.[^@]+$'", + "name": "accounts_email_check", + "entityType": "checks", + "schema": "public", + "table": "accounts" + }, + { + "value": "\"max_instances\" >= 0", + "name": "accounts_max_instances_check", + "entityType": "checks", + "schema": "public", + "table": "accounts" + }, + { + "value": "trim(both from \"name\") <> ''", + "name": "accounts_name_check", + "entityType": "checks", + "schema": "public", + "table": "accounts" + }, + { + "value": "(\"direction\" = 'inbound' AND \"status\" IN ('received', 'acknowledged', 'unverified', 'rejected')) OR (\"direction\" = 'outbound' AND \"status\" IN ('queued', 'sent', 'failed', 'permanently_failed', 'abandoned'))", + "name": "activity_deliveries_direction_status_check", + "entityType": "checks", + "schema": "public", + "table": "activity_deliveries" + }, + { + "value": "(\"completed\" IS NULL) = (\"status\" = 'queued')", + "name": "activity_deliveries_completed_check", + "entityType": "checks", + "schema": "public", + "table": "activity_deliveries" + }, + { + "value": "\"status_code\" IS NULL OR \"status_code\" BETWEEN 100 AND 599", + "name": "activity_deliveries_status_code_check", + "entityType": "checks", + "schema": "public", + "table": "activity_deliveries" + }, + { + "value": "\"direction\" <> 'outbound' OR \"verification_key_id\" IS NULL", + "name": "activity_deliveries_outbound_key_check", + "entityType": "checks", + "schema": "public", + "table": "activity_deliveries" + }, + { + "value": "(\"direction\" = 'inbound') = (\"verification_result\" IS NOT NULL)", + "name": "activity_deliveries_verification_result_check", + "entityType": "checks", + "schema": "public", + "table": "activity_deliveries" + }, + { + "value": "\"verification_mechanism\" IS NULL OR (\"direction\" = 'inbound' AND \"verification_result\" NOT IN ('unattempted', 'unobserved'))", + "name": "activity_deliveries_verification_mechanism_check", + "entityType": "checks", + "schema": "public", + "table": "activity_deliveries" + }, + { + "value": "(\"direction\" = 'inbound') = (\"body\" IS NOT NULL)", + "name": "activity_deliveries_body_check", + "entityType": "checks", + "schema": "public", + "table": "activity_deliveries" + }, + { + "value": "\"inbox_owner\" OR \"addressed\" OR \"sender\"", + "name": "activity_delivery_actors_role_check", + "entityType": "checks", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "value": "NOT \"addressed_directly\" OR \"addressed\"", + "name": "activity_delivery_actors_addressed_directly_check", + "entityType": "checks", + "schema": "public", + "table": "activity_delivery_actors" + }, + { + "value": "\"status_code\" IS NULL OR \"status_code\" BETWEEN 100 AND 599", + "name": "activity_delivery_attempts_status_code_check", + "entityType": "checks", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "value": "\"succeeded\" = (\"error\" IS NULL)", + "name": "activity_delivery_attempts_error_check", + "entityType": "checks", + "schema": "public", + "table": "activity_delivery_attempts" + }, + { + "value": "\"username\" NOT LIKE '%@%'", + "name": "actors_username_check", + "entityType": "checks", + "schema": "public", + "table": "actors" + }, + { + "value": "\n \"suspended_until\" IS NULL OR (\n \"suspended\" IS NOT NULL AND\n \"suspended_until\" > \"suspended\"\n )\n ", + "name": "actors_suspended_check", + "entityType": "checks", + "schema": "public", + "table": "actors" + }, + { + "value": "\"last_seen\" >= \"first_seen\"", + "name": "key_versions_seen_check", + "entityType": "checks", + "schema": "public", + "table": "key_versions" + }, + { + "value": "NOT (\"public_key\" ?| array['d','p','q','dp','dq','qi','oth','k'])", + "name": "key_versions_public_key_check", + "entityType": "checks", + "schema": "public", + "table": "key_versions" + }, + { + "value": "\"slug\" ~ '^[a-z0-9][a-z0-9-]{2,61}[a-z0-9]$'\n AND (\"slug\" !~ '^..--' OR \"slug\" ~ '^xn--')", + "name": "local_instances_slug_check", + "entityType": "checks", + "schema": "public", + "table": "local_instances" + }, + { + "value": "\"max_actors\" > 0", + "name": "instances_max_actors_check", + "entityType": "checks", + "schema": "public", + "table": "local_instances" + }, + { + "value": "trim(both from \"content_html\") <> ''", + "name": "objects_content_html_check", + "entityType": "checks", + "schema": "public", + "table": "objects" + } + ], + "renames": [ + "public.activities.actorId->public.activities.actor_id", + "public.activities.objectId->public.activities.object_id", + "public.actor_collection_references.actorId->public.actor_collection_references.actor_id", + "public.actor_collection_references.collectionId->public.actor_collection_references.collection_id", + "public.actors.localId->public.actors.local_id", + "public.actors.instanceId->public.actors.instance_id", + "public.actors.inboxUrl->public.actors.inbox_url", + "public.actors.profileUrl->public.actors.profile_url", + "public.actors.avatarUrl->public.actors.avatar_url", + "public.actors.headerUrl->public.actors.header_url", + "public.actors.bioHtml->public.actors.bio_html", + "public.actors.automaticallyApprovesFollowers->public.actors.automatically_approves_followers", + "public.actors.fieldHtmls->public.actors.field_htmls", + "public.actors.suspendedUntil->public.actors.suspended_until", + "public.actors.successorId->public.actors.successor_id", + "public.actors.followingCount->public.actors.following_count", + "public.actors.followersCount->public.actors.followers_count", + "public.addressing.sourceId->public.addressing.source_id", + "public.addressing.targetId->public.addressing.target_id", + "public.collection_items.collectionId->public.collection_items.collection_id", + "public.collection_items.itemId->public.collection_items.item_id", + "public.collections.ownerActorId->public.collections.owner_actor_id", + "public.collections.totalItems->public.collections.total_items", + "public.instance_members.accountId->public.instance_members.account_id", + "public.instance_members.instanceId->public.instance_members.instance_id", + "public.instances.localId->public.instances.local_id", + "public.instances.nodeInfoUrl->public.instances.node_info_url", + "public.instances.softwareVersion->public.instances.software_version", + "public.local_instances.maxActors->public.local_instances.max_actors", + "public.login_challenges.accountId->public.login_challenges.account_id", + "public.objects.actorId->public.objects.actor_id", + "public.objects.contentHtml->public.objects.content_html", + "public.sessions.accountId->public.sessions.account_id", + "public.sessions.tokenHash->public.sessions.token_hash" + ] +} diff --git a/packages/models/src/login-migration.test.ts b/packages/models/src/login-migration.test.ts index e9f6deb..a61dd2d 100644 --- a/packages/models/src/login-migration.test.ts +++ b/packages/models/src/login-migration.test.ts @@ -64,7 +64,11 @@ it("upgrades hashed challenges while preserving accounts and sessions", async () [uuidV7(), accountId, "b".repeat(64), "c".repeat(64)], ); const accounts = (await client.query("SELECT * FROM accounts")).rows; - const sessions = (await client.query("SELECT * FROM sessions")).rows; + const sessions = ( + await client.query( + 'SELECT id, "accountId" AS account_id, "tokenHash" AS token_hash, created, expires FROM sessions', + ) + ).rows; await migrate({ credentials: { driver: "pglite", client } }); assert.deepEqual( (await client.query("SELECT * FROM accounts")).rows, @@ -80,7 +84,7 @@ it("upgrades hashed challenges while preserving accounts and sessions", async () ); const id = uuidV7(); await client.query( - 'INSERT INTO login_challenges (id, "accountId", code) VALUES ($1, $2, $3)', + "INSERT INTO login_challenges (id, account_id, code) VALUES ($1, $2, $3)", [id, accountId, "abc123"], ); const row = ( diff --git a/packages/models/src/outbox-migration.test.ts b/packages/models/src/outbox-migration.test.ts index 649f1b3..20f67f8 100644 --- a/packages/models/src/outbox-migration.test.ts +++ b/packages/models/src/outbox-migration.test.ts @@ -56,28 +56,27 @@ it("backfills local outbox chronology and preserves other collection positions", await migrateBaseline(drizzle({ client }), { migrationsFolder: baseline }); const db = drizzle({ client, schema, relations }); const instanceId = uuidV7(); - await db - .insert(schema.instances) - .values({ id: instanceId, host: "migration.example" }); + await client.query("INSERT INTO instances (id, host) VALUES ($1, $2)", [ + instanceId, + "migration.example", + ]); const actorId = uuidV7(); const remoteId = uuidV7(); - await db.insert(schema.localActors).values({ id: actorId }); + await client.query("INSERT INTO local_actors (id) VALUES ($1)", [actorId]); for (const id of [actorId, remoteId]) { - await promoteResource( - db, - `https://migration.example/actors/${id}`, - "actor", - async (tx, row) => { - await tx.insert(schema.actors).values({ - id: row.id, - localId: id === actorId ? id : null, - instanceId, - type: "Person", - username: id, - inboxUrl: `https://migration.example/actors/${id}/inbox`, - }); - }, - id, + await client.query( + "INSERT INTO resources (id, iri, kind) VALUES ($1, $2, 'actor')", + [id, `https://migration.example/actors/${id}`], + ); + await client.query( + `INSERT INTO actors (id, "localId", "instanceId", type, username, "inboxUrl") VALUES ($1, $2, $3, 'Person', $4, $5)`, + [ + id, + id === actorId ? id : null, + instanceId, + id, + `https://migration.example/actors/${id}/inbox`, + ], ); } const outboxId = uuidV7(); @@ -88,53 +87,51 @@ it("backfills local outbox chronology and preserves other collection positions", [remoteOutboxId, remoteId, "outbox"], [featuredId, actorId, "featured"], ] as const) { - await promoteResource( - db, - `https://migration.example/collections/${id}`, - "collection", - async (tx, row) => { - await tx - .insert(schema.collections) - .values({ id: row.id, ownerActorId, type: "OrderedCollection" }); - await tx - .insert(schema.actorCollectionReferences) - .values({ actorId: ownerActorId, role, collectionId: row.id }); - }, - id, + await client.query( + "INSERT INTO resources (id, iri, kind) VALUES ($1, $2, 'collection')", + [id, `https://migration.example/collections/${id}`], + ); + await client.query( + `INSERT INTO collections (id, "ownerActorId", type) VALUES ($1, $2, 'OrderedCollection')`, + [id, ownerActorId], + ); + await client.query( + 'INSERT INTO actor_collection_references ("actorId", role, "collectionId") VALUES ($1, $2, $3)', + [ownerActorId, role, id], ); } const ids = [uuidV7(), uuidV7(), uuidV7()] as const; for (const [index, id] of ids.entries()) { - await promoteResource( - db, - `https://migration.example/activities/${id}`, - "activity", - async (tx, row) => { - await tx.insert(schema.activities).values({ - id: row.id, - actorId, - type: "Create", - published: Temporal.Instant.from( - index === 0 ? "2026-01-01T00:00:00Z" : "2026-01-02T00:00:00Z", - ), - }); - }, - id, + await client.query( + "INSERT INTO resources (id, iri, kind) VALUES ($1, $2, 'activity')", + [id, `https://migration.example/activities/${id}`], + ); + await client.query( + `INSERT INTO activities (id, "actorId", type, published) VALUES ($1, $2, 'Create', $3)`, + [ + id, + actorId, + index === 0 ? "2026-01-01T00:00:00Z" : "2026-01-02T00:00:00Z", + ], + ); + await client.query( + 'INSERT INTO collection_items ("collectionId", "itemId", position) VALUES ($1, $4, $5), ($2, $4, NULL), ($3, $4, $6)', + [ + outboxId, + remoteOutboxId, + featuredId, + id, + index === 0 ? -99 : null, + index, + ], ); - await db.insert(schema.collectionItems).values([ - { - collectionId: outboxId, - itemId: id, - position: index === 0 ? -99 : null, - }, - { collectionId: remoteOutboxId, itemId: id, position: null }, - { collectionId: featuredId, itemId: id, position: index }, - ]); } - const otherItems = await db.query.collectionItems.findMany({ - where: { collectionId: { ne: outboxId } }, - orderBy: { collectionId: "asc", itemId: "asc" }, - }); + const otherItems = ( + await client.query( + 'SELECT "collectionId" AS collection_id, "itemId" AS item_id, position, observed FROM collection_items WHERE "collectionId" <> $1 ORDER BY "collectionId", "itemId"', + [outboxId], + ) + ).rows; await migrate({ credentials: { driver: "pglite", client } }); const ordered = await db.query.collectionItems.findMany({ where: { collectionId: outboxId }, @@ -147,10 +144,12 @@ it("backfills local outbox chronology and preserves other collection positions", { itemId: ids[0], position: -1 }, ]); assert.deepEqual( - await db.query.collectionItems.findMany({ - where: { collectionId: { ne: outboxId } }, - orderBy: { collectionId: "asc", itemId: "asc" }, - }), + ( + await client.query( + "SELECT * FROM collection_items WHERE collection_id <> $1 ORDER BY collection_id, item_id", + [outboxId], + ) + ).rows, otherItems, ); const newest = uuidV7(); diff --git a/packages/models/src/resource.test.ts b/packages/models/src/resource.test.ts index 7cc5b80..929f38f 100644 --- a/packages/models/src/resource.test.ts +++ b/packages/models/src/resource.test.ts @@ -206,9 +206,9 @@ it("indexes activities by referenced object in connection order", async () => { const definitions = rows.map((row) => row.indexdef); assert.ok( definitions.some((definition) => - /\("objectId", published, id\)$/u.test(definition), + /\(object_id, published, id\)$/u.test(definition), ), - `No (objectId, published, id) index on activities:\n${definitions.join("\n")}`, + `No (object_id, published, id) index on activities:\n${definitions.join("\n")}`, ); } finally { await client.close(); diff --git a/packages/models/src/schema.ts b/packages/models/src/schema.ts index a770624..7cea79e 100644 --- a/packages/models/src/schema.ts +++ b/packages/models/src/schema.ts @@ -86,7 +86,7 @@ export type NewAccount = typeof accounts.$inferInsert; */ export const instances = pgTable("instances", { id: uuid().$type().primaryKey(), - localId: uuid() + localId: uuid("local_id") .$type() .references(() => localInstances.id, { onDelete: "cascade", @@ -99,9 +99,9 @@ export const instances = pgTable("instances", { // port. Both locally composed `.` names and remote // hosts discovered from the fediverse live here. host: varchar({ length: 259 }).notNull().unique(), - nodeInfoUrl: text(), + nodeInfoUrl: text("node_info_url"), software: text(), - softwareVersion: text(), + softwareVersion: text("software_version"), }); export type Instance = typeof instances.$inferSelect; @@ -113,7 +113,7 @@ export const localInstances = pgTable( id: uuid().$type().primaryKey(), slug: varchar({ length: 63 }).notNull().unique(), expires: instant().notNull(), - maxActors: integer().notNull().default(10), + maxActors: integer("max_actors").notNull().default(10), }, (table) => [ // Keep this in agreement with `isValidSlug()` in ./slug.ts. A slug @@ -141,11 +141,11 @@ export type NewLocalInstance = typeof localInstances.$inferInsert; export const instanceMembers = pgTable( "instance_members", { - accountId: uuid() + accountId: uuid("account_id") .$type() .notNull() .references(() => accounts.id), - instanceId: uuid() + instanceId: uuid("instance_id") .$type() .notNull() .references(() => instances.id), @@ -176,7 +176,7 @@ export const LOGIN_CHALLENGE_CODE_LENGTH = 6; */ export const loginChallenges = pgTable("login_challenges", { id: uuid().$type().primaryKey(), - accountId: uuid() + accountId: uuid("account_id") .$type() .notNull() .references(() => accounts.id, { onDelete: "cascade" }), @@ -197,11 +197,11 @@ export type NewLoginChallenge = typeof loginChallenges.$inferInsert; */ export const sessions = pgTable("sessions", { id: uuid().$type().primaryKey(), - accountId: uuid() + accountId: uuid("account_id") .$type() .notNull() .references(() => accounts.id, { onDelete: "cascade" }), - tokenHash: varchar({ length: 64 }).notNull().unique(), + tokenHash: varchar("token_hash", { length: 64 }).notNull().unique(), created: instant().notNull().default(currentTimestamp), expires: instant() .notNull() @@ -249,25 +249,30 @@ export const actors = pgTable( .$type() .primaryKey() .references(() => resources.id, { onDelete: "cascade" }), - localId: uuid() + localId: uuid("local_id") .$type() .unique() .references(() => localActors.id, { onDelete: "cascade" }), type: actorTypeEnum().notNull(), username: text().notNull(), - instanceId: uuid() + instanceId: uuid("instance_id") .$type() .notNull() .references(() => instances.id, { onDelete: "cascade" }), document: json(), - inboxUrl: text().notNull(), - profileUrl: text(), - avatarUrl: text(), - headerUrl: text(), + inboxUrl: text("inbox_url").notNull(), + profileUrl: text("profile_url"), + avatarUrl: text("avatar_url"), + headerUrl: text("header_url"), name: text(), - bioHtml: text(), - automaticallyApprovesFollowers: boolean().notNull().default(false), - fieldHtmls: jsonb().$type>().notNull().default({}), + bioHtml: text("bio_html"), + automaticallyApprovesFollowers: boolean("automatically_approves_followers") + .notNull() + .default(false), + fieldHtmls: jsonb("field_htmls") + .$type>() + .notNull() + .default({}), emojis: jsonb().$type>().notNull().default({}), tags: jsonb().$type>().notNull().default({}), sensitive: boolean().notNull().default(false), @@ -281,8 +286,8 @@ export const actors = pgTable( // comparing against the current time (lazy expiry; no cron): // Temporal.Instant.compare(suspended, now) <= 0 AND (suspendedUntil IS NULL OR Temporal.Instant.compare(suspendedUntil, now) > 0). suspended: instant(), - suspendedUntil: instant(), - successorId: uuid() + suspendedUntil: instant("suspended_until"), + successorId: uuid("successor_id") .$type() .references((): AnyPgColumn => actors.id, { onDelete: "set null", @@ -291,8 +296,8 @@ export const actors = pgTable( .array() .notNull() .default(sql`(ARRAY[]::text[])`), - followingCount: integer().notNull().default(0), - followersCount: integer().notNull().default(0), + followingCount: integer("following_count").notNull().default(0), + followersCount: integer("followers_count").notNull().default(0), updated: instant() .notNull() .default(currentTimestamp) @@ -342,7 +347,7 @@ export const objects = pgTable( .$type() .primaryKey() .references(() => resources.id, { onDelete: "cascade" }), - actorId: uuid() + actorId: uuid("actor_id") .$type() .notNull() .references(() => actors.id, { onDelete: "cascade" }), @@ -351,7 +356,7 @@ export const objects = pgTable( url: text(), name: text(), summary: text(), - contentHtml: text().notNull(), + contentHtml: text("content_html").notNull(), language: varchar({ length: 35 }), sensitive: boolean().notNull().default(false), published: instant().notNull().default(currentTimestamp), @@ -399,10 +404,10 @@ export const collections = pgTable("collections", { * the owner cascades to the collection and all references. Soft deletion * hides the collection and every actor's reference to it from GraphQL. */ - ownerActorId: uuid() + ownerActorId: uuid("owner_actor_id") .$type() .references(() => actors.id, { onDelete: "cascade" }), - totalItems: integer(), + totalItems: integer("total_items"), document: json(), updated: instant() .notNull() @@ -415,12 +420,12 @@ export type Collection = typeof collections.$inferSelect; export const actorCollectionReferences = pgTable( "actor_collection_references", { - actorId: uuid() + actorId: uuid("actor_id") .$type() .notNull() .references(() => actors.id, { onDelete: "cascade" }), role: collectionRoleEnum().notNull(), - collectionId: uuid() + collectionId: uuid("collection_id") .$type() .notNull() .references(() => collections.id, { onDelete: "cascade" }), @@ -434,11 +439,11 @@ export const actorCollectionReferences = pgTable( export const collectionItems = pgTable( "collection_items", { - collectionId: uuid() + collectionId: uuid("collection_id") .$type() .notNull() .references(() => collections.id, { onDelete: "cascade" }), - itemId: uuid() + itemId: uuid("item_id") .$type() .notNull() .references(() => resources.id, { onDelete: "cascade" }), @@ -460,11 +465,11 @@ export const activities = pgTable( .primaryKey() .references(() => resources.id, { onDelete: "cascade" }), type: activityTypeEnum().notNull(), - actorId: uuid() + actorId: uuid("actor_id") .$type() .notNull() .references(() => actors.id, { onDelete: "cascade" }), - objectId: uuid() + objectId: uuid("object_id") .$type() .references(() => resources.id, { onDelete: "cascade" }), published: instant().notNull(), @@ -495,13 +500,13 @@ export const addressing = pgTable( "addressing", { id: uuid().$type().primaryKey(), - sourceId: uuid() + sourceId: uuid("source_id") .$type() .notNull() .references(() => resources.id, { onDelete: "cascade" }), property: addressingPropertyEnum().notNull(), position: integer().notNull(), - targetId: uuid() + targetId: uuid("target_id") .$type() .notNull() .references(() => resources.id, { onDelete: "restrict" }),