oficina / mapa Public

Clone
git clone https://amadan.net/oficina/mapa

Plain git — no account needed to clone.

Download

Download this file

1-- Generated by rastrillo migration generate; DO NOT EDIT.
2-- The schema every migration in this directory adds up to.
3
4CREATE TABLE `aliases` (`id` integer PRIMARY KEY AUTOINCREMENT,`page_id` integer NOT NULL,`sealed_title` blob,CONSTRAINT `fk_aliases_page` FOREIGN KEY (`page_id`) REFERENCES `pages`(`id`) ON DELETE CASCADE);
5
6CREATE TABLE `daily_prints` (`print` text,`page_id` integer NOT NULL,PRIMARY KEY (`print`),CONSTRAINT `fk_daily_prints_page` FOREIGN KEY (`page_id`) REFERENCES `pages`(`id`) ON DELETE CASCADE);
7
8CREATE TABLE `drafts` (`id` integer PRIMARY KEY AUTOINCREMENT,`page_id` integer,`daily_print` text,`person_id` integer,`base_revision` integer,`version` integer NOT NULL,`sealed_record` blob,`updated_at` datetime);
9
10CREATE TABLE `events` (`id` integer PRIMARY KEY AUTOINCREMENT,`nonce` integer NOT NULL,`at` datetime NOT NULL,`actor_id` integer NOT NULL,`object_kind` text NOT NULL,`object_id` integer NOT NULL,`verb` text NOT NULL,`revision` integer NOT NULL);
11
12CREATE TABLE `image_trash` (`object_key` text,`queued_at` datetime NOT NULL,PRIMARY KEY (`object_key`));
13
14CREATE TABLE `images` (`id` integer PRIMARY KEY AUTOINCREMENT,`public_id` text NOT NULL,`owner_id` integer NOT NULL,`page_id` integer,`created_at` datetime NOT NULL,`unreferenced_at` datetime,`stored_bytes` integer NOT NULL,`moved_from` integer,`object_key` text NOT NULL,`sealed_record` blob);
15
16CREATE TABLE `members` (`id` integer PRIMARY KEY AUTOINCREMENT,`address_print` text NOT NULL,`sealed_address` blob,`sealed_time_zone` blob, `sealed_pins` blob, `sealed_locale` blob);
17
18CREATE TABLE `notion_connections` (`id` integer PRIMARY KEY AUTOINCREMENT,`created_by` integer NOT NULL,`created_at` datetime,`verified_at` datetime,`sealed_token` blob,`sealed_workspace` blob);
19
20CREATE TABLE `notion_images` (`id` integer PRIMARY KEY AUTOINCREMENT,`place_print` text NOT NULL,`block_print` text NOT NULL,`state` text NOT NULL,`sealed_record` blob);
21
22CREATE TABLE `notion_pages` (`id` integer PRIMARY KEY AUTOINCREMENT,`notion_print` text NOT NULL,`state` text NOT NULL,`error_code` text,`surveyed_run` integer NOT NULL DEFAULT 0,`seen_run` integer NOT NULL DEFAULT 0,`sealed_coordinate` blob,`sealed_staged` blob);
23
24CREATE TABLE `notion_runs` (`id` integer PRIMARY KEY AUTOINCREMENT,`actor` integer NOT NULL,`state` text NOT NULL,`lease` integer NOT NULL,`started_at` datetime,`heartbeat_at` datetime,`progress_at` datetime,`finished_at` datetime,`surveyed` integer NOT NULL DEFAULT 0,`total` integer NOT NULL DEFAULT 0,`written` integer NOT NULL DEFAULT 0,`created` integer NOT NULL DEFAULT 0,`updated` integer NOT NULL DEFAULT 0,`unchanged` integer NOT NULL DEFAULT 0,`kept` integer NOT NULL DEFAULT 0,`failed` integer NOT NULL DEFAULT 0,`error_code` text);
25
26CREATE TABLE `pages` (`id` integer PRIMARY KEY AUTOINCREMENT,`nonce` integer NOT NULL,`kind` text NOT NULL,`rung` text NOT NULL,`owner_id` integer NOT NULL,`revision` integer NOT NULL,`gone` numeric NOT NULL DEFAULT false,`sealed_record` blob,`created_at` datetime,`updated_at` datetime,CONSTRAINT `fk_pages_owner` FOREIGN KEY (`owner_id`) REFERENCES `members`(`id`) ON DELETE RESTRICT);
27
28CREATE TABLE `revisions` (`page_id` integer,`revision` integer,`at` datetime NOT NULL,`actor_id` integer NOT NULL,`sealed_record` blob,PRIMARY KEY (`page_id`,`revision`),CONSTRAINT `fk_revisions_page` FOREIGN KEY (`page_id`) REFERENCES `pages`(`id`) ON DELETE CASCADE);
29
30CREATE TABLE `title_prints` (`print` text,`page_id` integer NOT NULL,PRIMARY KEY (`print`),CONSTRAINT `fk_title_prints_page` FOREIGN KEY (`page_id`) REFERENCES `pages`(`id`) ON DELETE CASCADE);
31
32CREATE UNIQUE INDEX `draft_day` ON `drafts`(`daily_print`,`person_id`);
33
34CREATE UNIQUE INDEX `draft_page` ON `drafts`(`page_id`,`person_id`);
35
36CREATE INDEX `idx_aliases_page_id` ON `aliases`(`page_id`);
37
38CREATE UNIQUE INDEX `idx_daily_prints_page_id` ON `daily_prints`(`page_id`);
39
40CREATE INDEX `idx_drafts_updated_at` ON `drafts`(`updated_at`);
41
42CREATE INDEX `idx_events_actor_id` ON `events`(`actor_id`);
43
44CREATE INDEX `idx_events_actor_page` ON `events`(`actor_id`,`object_kind`,`object_id`);
45
46CREATE INDEX `idx_events_at` ON `events`(`at`);
47
48CREATE INDEX `idx_events_object_id` ON `events`(`object_id`);
49
50CREATE UNIQUE INDEX `idx_images_public_id` ON `images`(`public_id`);
51
52CREATE UNIQUE INDEX `idx_members_address_print` ON `members`(`address_print`);
53
54CREATE INDEX `idx_notion_images_block_print` ON `notion_images`(`block_print`);
55
56CREATE UNIQUE INDEX `idx_notion_images_place_print` ON `notion_images`(`place_print`);
57
58CREATE UNIQUE INDEX `idx_notion_pages_notion_print` ON `notion_pages`(`notion_print`);
59
60CREATE INDEX `idx_notion_runs_state` ON `notion_runs`(`state`);
61
62CREATE INDEX `idx_pages_gone` ON `pages`(`gone`);
63
64CREATE INDEX `idx_pages_kind` ON `pages`(`kind`);
65
66CREATE UNIQUE INDEX `idx_pages_nonce` ON `pages`(`nonce`);
67
68CREATE INDEX `idx_pages_owner_id` ON `pages`(`owner_id`);
69
70CREATE INDEX `idx_pages_updated_at` ON `pages`(`updated_at`);
71
72CREATE INDEX `idx_revisions_at` ON `revisions`(`at`);
73
74CREATE INDEX `idx_title_prints_page_id` ON `title_prints`(`page_id`);
75
76CREATE INDEX `img_owner` ON `images`(`owner_id`,`page_id`);
77
78CREATE INDEX `img_page` ON `images`(`page_id`,`unreferenced_at`);
79
80