feat: add usage and download intent accounting

This commit is contained in:
Leon Tonhäuser committed 2026-08-09 22:52:27 +02:00
1 parent 846904f3db
commit 22fe6bf659
14 files changed
+3008 -2

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
ALTER TABLE "download_events" ADD COLUMN "intent_kind" text DEFAULT 'new_usage' NOT NULL;--> statement-breakpoint
ALTER TABLE "download_events" ADD COLUMN "request_fingerprint" varchar(64);--> statement-breakpoint
UPDATE "download_events"
SET "request_fingerprint" = md5("editorial_account_id"::text || ':' || "id"::text) || md5("id"::text || ':' || "editorial_account_id"::text);--> statement-breakpoint
ALTER TABLE "download_events" ALTER COLUMN "request_fingerprint" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "download_events" ADD CONSTRAINT "download_events_intent_kind_check" CHECK ("download_events"."intent_kind" in ('new_usage', 'repeat_download'));--> statement-breakpoint
ALTER TABLE "download_events" ADD CONSTRAINT "download_events_request_fingerprint_hex_check" CHECK ("download_events"."request_fingerprint" ~ '^[0-9a-f]{64}$');
File diff suppressed because it is too large. Load diff
+7
View File
@@ -15,6 +15,13 @@
"when": 1786303607054,
"tag": "0001_editorial_approval_notice",
"breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1786308409516,
"tag": "0002_accounting_intents",
"breakpoints": true
}
]
}