@hollware/server 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,57 @@
1
+ CREATE TABLE `deliveries` (
2
+ `id` text PRIMARY KEY NOT NULL,
3
+ `site_id` text NOT NULL,
4
+ `event_id` text NOT NULL,
5
+ `subscriber` text NOT NULL,
6
+ `attempts` integer NOT NULL,
7
+ `delivered_at` text,
8
+ `last_error` text,
9
+ `created_at` text NOT NULL,
10
+ `updated_at` text NOT NULL,
11
+ FOREIGN KEY (`site_id`) REFERENCES `sites`(`id`) ON UPDATE no action ON DELETE no action,
12
+ FOREIGN KEY (`event_id`,`site_id`) REFERENCES `outbox`(`id`,`site_id`) ON UPDATE no action ON DELETE no action,
13
+ CONSTRAINT "deliveries_attempts" CHECK("deliveries"."attempts" >= 0)
14
+ );
15
+ --> statement-breakpoint
16
+ CREATE UNIQUE INDEX `deliveries_id_site` ON `deliveries` (`id`,`site_id`);--> statement-breakpoint
17
+ CREATE UNIQUE INDEX `deliveries_event_subscriber` ON `deliveries` (`event_id`,`subscriber`);--> statement-breakpoint
18
+ CREATE TABLE `outbox` (
19
+ `id` text PRIMARY KEY NOT NULL,
20
+ `site_id` text NOT NULL,
21
+ `kind` text NOT NULL,
22
+ `entry_id` text NOT NULL,
23
+ `payload` text NOT NULL,
24
+ `sent_at` text,
25
+ `created_at` text NOT NULL,
26
+ `updated_at` text NOT NULL,
27
+ FOREIGN KEY (`site_id`) REFERENCES `sites`(`id`) ON UPDATE no action ON DELETE no action,
28
+ CONSTRAINT "outbox_kind" CHECK("outbox"."kind" IN ('entry.published', 'entry.unpublished')),
29
+ CONSTRAINT "outbox_json" CHECK(json_valid("outbox"."payload") AND json_type("outbox"."payload") = 'object')
30
+ );
31
+ --> statement-breakpoint
32
+ CREATE INDEX `outbox_unsent` ON `outbox` (`sent_at`,`created_at`);--> statement-breakpoint
33
+ CREATE UNIQUE INDEX `outbox_id_site` ON `outbox` (`id`,`site_id`);--> statement-breakpoint
34
+ CREATE TABLE `schedules` (
35
+ `id` text PRIMARY KEY NOT NULL,
36
+ `site_id` text NOT NULL,
37
+ `entry_id` text NOT NULL,
38
+ `scheduled_at` text NOT NULL,
39
+ `version` integer NOT NULL,
40
+ `acknowledged` text NOT NULL,
41
+ `actor_kind` text NOT NULL,
42
+ `actor_user_id` text NOT NULL,
43
+ `actor_token_id` text,
44
+ `actor_meta` text,
45
+ `created_at` text NOT NULL,
46
+ `updated_at` text NOT NULL,
47
+ FOREIGN KEY (`site_id`) REFERENCES `sites`(`id`) ON UPDATE no action ON DELETE no action,
48
+ FOREIGN KEY (`entry_id`,`site_id`) REFERENCES `entries`(`id`,`site_id`) ON UPDATE no action ON DELETE no action,
49
+ FOREIGN KEY (`actor_user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action,
50
+ FOREIGN KEY (`actor_token_id`,`site_id`) REFERENCES `tokens`(`id`,`site_id`) ON UPDATE no action ON DELETE no action,
51
+ CONSTRAINT "schedules_actor_kind" CHECK("schedules"."actor_kind" IN ('token', 'user', 'oauth_client')),
52
+ CONSTRAINT "schedules_json" CHECK(json_valid("schedules"."acknowledged") AND json_type("schedules"."acknowledged") = 'array' AND ("schedules"."actor_meta" IS NULL OR json_valid("schedules"."actor_meta")))
53
+ );
54
+ --> statement-breakpoint
55
+ CREATE INDEX `schedules_due` ON `schedules` (`scheduled_at`);--> statement-breakpoint
56
+ CREATE UNIQUE INDEX `schedules_id_site` ON `schedules` (`id`,`site_id`);--> statement-breakpoint
57
+ CREATE UNIQUE INDEX `schedules_entry` ON `schedules` (`site_id`,`entry_id`);