@hollware/server 0.9.0 → 0.10.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.
- package/dist/{ceremonies-D5dIEbha.mjs → ceremonies-DDoGdUD7.mjs} +1 -1
- package/dist/index.d.mts +48 -4
- package/dist/index.mjs +289 -68
- package/dist/{store-C2hiR0yd.mjs → store-BPr9-wKy.mjs} +12 -4
- package/migrations/0013_site_events.sql +31 -0
- package/migrations/0014_entry_trash.sql +1 -0
- package/migrations/meta/0013_snapshot.json +2619 -0
- package/migrations/meta/0014_snapshot.json +2626 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +8 -8
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
-- Edited by hand (ADR-023): the outbox takes the events of a change of a site's structure
|
|
2
|
+
-- (`site.changed`, ADR-033), which are about no entry, so the table is rebuilt with a wider kind and
|
|
3
|
+
-- an entry_id that only such an event leaves empty. `deliveries` points at the outbox, and SQLite
|
|
4
|
+
-- counts a row that points at a dropped table as broken even when the rebuilt one holds its key, so
|
|
5
|
+
-- the deliveries are set aside, the outbox is rebuilt with nothing pointing at it, and they come
|
|
6
|
+
-- back, every one to a row that exists. The PRAGMA foreign_keys lines drizzle-kit writes are gone,
|
|
7
|
+
-- as D1 ignores them, and the CHECKs name their columns without the temporary table's name.
|
|
8
|
+
CREATE TABLE `__kept_deliveries` AS SELECT * FROM `deliveries`;--> statement-breakpoint
|
|
9
|
+
DELETE FROM `deliveries`;--> statement-breakpoint
|
|
10
|
+
CREATE TABLE `__new_outbox` (
|
|
11
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
12
|
+
`site_id` text NOT NULL,
|
|
13
|
+
`kind` text NOT NULL,
|
|
14
|
+
`entry_id` text,
|
|
15
|
+
`payload` text NOT NULL,
|
|
16
|
+
`sent_at` text,
|
|
17
|
+
`created_at` text NOT NULL,
|
|
18
|
+
`updated_at` text NOT NULL,
|
|
19
|
+
FOREIGN KEY (`site_id`) REFERENCES `sites`(`id`) ON UPDATE no action ON DELETE no action,
|
|
20
|
+
CONSTRAINT "outbox_kind" CHECK("kind" IN ('entry.published', 'entry.unpublished', 'site.changed')),
|
|
21
|
+
CONSTRAINT "outbox_entry" CHECK(("kind" = 'site.changed') = ("entry_id" IS NULL)),
|
|
22
|
+
CONSTRAINT "outbox_json" CHECK(json_valid("payload") AND json_type("payload") = 'object')
|
|
23
|
+
);
|
|
24
|
+
--> statement-breakpoint
|
|
25
|
+
INSERT INTO `__new_outbox`("id", "site_id", "kind", "entry_id", "payload", "sent_at", "created_at", "updated_at") SELECT "id", "site_id", "kind", "entry_id", "payload", "sent_at", "created_at", "updated_at" FROM `outbox`;--> statement-breakpoint
|
|
26
|
+
DROP TABLE `outbox`;--> statement-breakpoint
|
|
27
|
+
ALTER TABLE `__new_outbox` RENAME TO `outbox`;--> statement-breakpoint
|
|
28
|
+
CREATE INDEX `outbox_unsent` ON `outbox` (`sent_at`,`created_at`);--> statement-breakpoint
|
|
29
|
+
CREATE UNIQUE INDEX `outbox_id_site` ON `outbox` (`id`,`site_id`);--> statement-breakpoint
|
|
30
|
+
INSERT INTO `deliveries` SELECT * FROM `__kept_deliveries`;--> statement-breakpoint
|
|
31
|
+
DROP TABLE `__kept_deliveries`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `entries` ADD `deleted_at` text;
|