| 1 | -- Generated by rastrillo migration generate; DO NOT EDIT. |
| 2 | -- The schema every migration in this directory adds up to. |
| 3 | |
| 4 | CREATE TABLE `chunks` (`id` integer PRIMARY KEY AUTOINCREMENT,`document_id` integer NOT NULL,`ordinal` integer NOT NULL,`sealed_heading` blob,`sealed_text` blob NOT NULL,`created_at` datetime,CONSTRAINT `fk_documents_chunks` FOREIGN KEY (`document_id`) REFERENCES `documents`(`id`) ON DELETE CASCADE); |
| 5 | |
| 6 | CREATE TABLE `connectors` (`id` integer PRIMARY KEY AUTOINCREMENT,`kind` text NOT NULL,`sealed_token` blob NOT NULL,`workspace_print` text,`last_verified` datetime,`created_at` datetime,`updated_at` datetime); |
| 7 | |
| 8 | CREATE TABLE `documents` (`id` integer PRIMARY KEY AUTOINCREMENT,`source` text NOT NULL,`external_id` text NOT NULL,`revision` integer NOT NULL DEFAULT 1,`sealed_title` blob NOT NULL,`sealed_body` blob NOT NULL,`bytes` integer,`created_at` datetime,`updated_at` datetime, `body_print` text NOT NULL DEFAULT "", `sealed_path` blob, `sibling_item_id` blob, `sibling_revision` integer NOT NULL DEFAULT 0); |
| 9 | |
| 10 | CREATE TABLE `sibling_feeds` (`id` integer PRIMARY KEY AUTOINCREMENT,`app` text NOT NULL,`sealed_cursor` blob,`polled_at` datetime,`reconciling` numeric NOT NULL DEFAULT false,`created_at` datetime,`updated_at` datetime, `counting_since` datetime); |
| 11 | |
| 12 | CREATE TABLE `sibling_tallies` (`id` integer PRIMARY KEY AUTOINCREMENT,`app` text NOT NULL,`asker_print` text NOT NULL,`day` text NOT NULL,`sealed_counts` blob NOT NULL,`created_at` datetime,`updated_at` datetime); |
| 13 | |
| 14 | CREATE TABLE `source_pages` (`id` integer PRIMARY KEY AUTOINCREMENT,`connector_id` integer NOT NULL,`page_print` text NOT NULL,`sealed_page_id` blob NOT NULL,`sealed_path` blob,`path_print` text,`seen_edited` text,`ingested_edited` text,`ingested_path` text,`state` text NOT NULL DEFAULT "pending",`error_code` text,`last_seen` datetime,`document_id` integer,`created_at` datetime,`updated_at` datetime); |
| 15 | |
| 16 | CREATE TABLE `sync_runs` (`id` integer PRIMARY KEY AUTOINCREMENT,`connector_id` integer NOT NULL,`state` text NOT NULL,`roots` integer,`total` integer NOT NULL DEFAULT -1,`fetched` integer,`skipped` integer,`empty` integer,`failed_pages` integer,`unread_blocks` integer,`error_code` text,`heartbeat` datetime,`started_at` datetime,`finished_at` datetime); |
| 17 | |
| 18 | CREATE INDEX `idx_chunks_document_id` ON `chunks`(`document_id`); |
| 19 | |
| 20 | CREATE UNIQUE INDEX `idx_connectors_kind` ON `connectors`(`kind`); |
| 21 | |
| 22 | CREATE INDEX `idx_documents_external_id` ON `documents`(`external_id`); |
| 23 | |
| 24 | CREATE INDEX `idx_documents_source` ON `documents`(`source`); |
| 25 | |
| 26 | CREATE UNIQUE INDEX `idx_sibling_feeds_app` ON `sibling_feeds`(`app`); |
| 27 | |
| 28 | CREATE INDEX `idx_sibling_tallies_day` ON `sibling_tallies`(`day`); |
| 29 | |
| 30 | CREATE INDEX `idx_source_pages_connector_id` ON `source_pages`(`connector_id`); |
| 31 | |
| 32 | CREATE INDEX `idx_source_pages_page_print` ON `source_pages`(`page_print`); |
| 33 | |
| 34 | CREATE INDEX `idx_source_pages_state` ON `source_pages`(`state`); |
| 35 | |
| 36 | CREATE INDEX `idx_sync_runs_connector_id` ON `sync_runs`(`connector_id`); |
| 37 | |
| 38 | CREATE INDEX `idx_sync_runs_state` ON `sync_runs`(`state`); |
| 39 | |
| 40 | CREATE UNIQUE INDEX `idx_tally` ON `sibling_tallies`(`app`,`asker_print`,`day`); |
| 41 | |
| 42 | |