@netsirk/hippocampe-linux-x64 0.0.0-stage → 0.6.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/bin/hippo +4 -0
- package/bin/migrations/20261006095556_baseline/migration.sql +201 -0
- package/bin/migrations/20261006095556_baseline/snapshot.json +2298 -0
- package/bin/migrations/20261006100925_sensitive_types/migration.sql +1 -0
- package/bin/migrations/20261006100925_sensitive_types/snapshot.json +2311 -0
- package/bin/migrations/20261006103751_entry_sources/migration.sql +1 -0
- package/bin/migrations/20261006103751_entry_sources/snapshot.json +2324 -0
- package/bin/migrations/20261006104542_inbox/migration.sql +20 -0
- package/bin/migrations/20261006104542_inbox/snapshot.json +2562 -0
- package/bin/migrations/20261006111614_inbox_mime/migration.sql +1 -0
- package/bin/migrations/20261006111614_inbox_mime/snapshot.json +2575 -0
- package/bin/migrations/20261006120126_search_index/migration.sql +9 -0
- package/bin/migrations/20261006120126_search_index/snapshot.json +2620 -0
- package/bin/migrations/20261006160724_findings/migration.sql +36 -0
- package/bin/migrations/20261006160724_findings/snapshot.json +3068 -0
- package/bin/migrations/20261007073146_instance_rules/migration.sql +6 -0
- package/bin/migrations/20261007073146_instance_rules/snapshot.json +3128 -0
- package/bin/migrations/20261007080007_read_in_parent/migration.sql +1 -0
- package/bin/migrations/20261007080007_read_in_parent/snapshot.json +3141 -0
- package/bin/migrations/20261007084816_pending_references/migration.sql +8 -0
- package/bin/migrations/20261007084816_pending_references/snapshot.json +3215 -0
- package/bin/migrations/20261007085835_merged_findings/migration.sql +1 -0
- package/bin/migrations/20261007085835_merged_findings/snapshot.json +3228 -0
- package/bin/migrations/20261007105935_merged_into_key/migration.sql +1 -0
- package/bin/migrations/20261007105935_merged_into_key/snapshot.json +3241 -0
- package/bin/migrations/20261007111353_remove_source_registry/migration.sql +13 -0
- package/bin/migrations/20261007111353_remove_source_registry/snapshot.json +3149 -0
- package/bin/migrations/20261007115731_link_note_and_dates/migration.sql +3 -0
- package/bin/migrations/20261007115731_link_note_and_dates/snapshot.json +3188 -0
- package/bin/migrations/20261008075945_resolve_stale_pending/migration.sql +11 -0
- package/bin/migrations/20261008075945_resolve_stale_pending/snapshot.json +3188 -0
- package/bin/migrations/20261008081223_archived_reason/migration.sql +1 -0
- package/bin/migrations/20261008081223_archived_reason/snapshot.json +3201 -0
- package/bin/migrations/20261009160041_entries_aliases/migration.sql +1 -0
- package/bin/migrations/20261009160041_entries_aliases/snapshot.json +3222 -0
- package/bin/migrations/20261009182911_known_or_supposed/migration.sql +32 -0
- package/bin/migrations/20261009182911_known_or_supposed/snapshot.json +3229 -0
- package/bin/migrations/20261009194740_part_of/migration.sql +86 -0
- package/bin/migrations/20261009194740_part_of/snapshot.json +3232 -0
- package/bin/migrations/20261009210344_rename_to_hippocampe/migration.sql +28 -0
- package/bin/migrations/20261009210344_rename_to_hippocampe/snapshot.json +3232 -0
- package/package.json +17 -4
- package/README.md +0 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
-- A field named `body` or `summary` would share its key in `provenance` with the body or the
|
|
2
|
+
-- summary of its entry: refused, rather than guessed at. The owner renames it first.
|
|
3
|
+
DO $$
|
|
4
|
+
DECLARE
|
|
5
|
+
clashes text;
|
|
6
|
+
BEGIN
|
|
7
|
+
SELECT string_agg(format('the type `%s` has a field `%s`', t.name, f ->> 'name'), ' and '
|
|
8
|
+
ORDER BY t.name, f ->> 'name')
|
|
9
|
+
INTO clashes
|
|
10
|
+
FROM "types" t, jsonb_array_elements(t.fields) AS f
|
|
11
|
+
WHERE f ->> 'name' IN ('body', 'summary');
|
|
12
|
+
IF clashes IS NOT NULL THEN
|
|
13
|
+
RAISE EXCEPTION '%', upper(left(clashes, 1)) || substr(clashes, 2)
|
|
14
|
+
|| ': they are the keys of the provenance of the summary and the body of an entry. Rename these fields first (`change_type` with `field` and `rename`), then start again.';
|
|
15
|
+
END IF;
|
|
16
|
+
END $$;
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
-- Every value, link, body and summary says whether it is known or supposed. What was written
|
|
19
|
+
-- before Grenier asked is `unstated`: kept, and listed apart from the suppositions, so the owner
|
|
20
|
+
-- is not asked to review the past at once. A provenance already stored stays as it is. The
|
|
21
|
+
-- events keep their past changes, `verified` included.
|
|
22
|
+
ALTER TABLE "links" ADD COLUMN "provenance" text;--> statement-breakpoint
|
|
23
|
+
-- A `mentions` link has no provenance of its own: it takes its body's.
|
|
24
|
+
UPDATE "links" SET "provenance" = 'unstated' WHERE "relation" <> 'mentions';--> statement-breakpoint
|
|
25
|
+
UPDATE "entries" SET "provenance" =
|
|
26
|
+
(SELECT coalesce(jsonb_object_agg(k, 'unstated'), '{}'::jsonb) FROM jsonb_object_keys("fields") AS k)
|
|
27
|
+
|| CASE WHEN "body" <> '' THEN '{"body": "unstated"}'::jsonb ELSE '{}'::jsonb END
|
|
28
|
+
|| CASE WHEN "summary" <> '' THEN '{"summary": "unstated"}'::jsonb ELSE '{}'::jsonb END
|
|
29
|
+
|| "provenance";--> statement-breakpoint
|
|
30
|
+
ALTER TABLE "entries" DROP COLUMN "verified";--> statement-breakpoint
|
|
31
|
+
ALTER TABLE "links" ADD CONSTRAINT "links_provenance" CHECK ((relation = 'mentions') = (provenance IS NULL)
|
|
32
|
+
AND (provenance IS NULL OR provenance IN ('extracted', 'inferred', 'unstated')));
|