@marinoscar/kvox-eval 0.0.0-bootstrap → 0.1.0-next.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/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/README.md +166 -0
- package/dist/ask/index.d.ts +6 -0
- package/dist/ask/index.js +28 -0
- package/dist/ask/question-schema.d.ts +121 -0
- package/dist/ask/question-schema.js +167 -0
- package/dist/ask/report.d.ts +88 -0
- package/dist/ask/report.js +170 -0
- package/dist/ask/scorer.d.ts +104 -0
- package/dist/ask/scorer.js +164 -0
- package/dist/ask-run/ask-command.d.ts +62 -0
- package/dist/ask-run/ask-command.js +254 -0
- package/dist/ask-run/host/app.d.ts +65 -0
- package/dist/ask-run/host/app.js +146 -0
- package/dist/ask-run/host/db.d.ts +38 -0
- package/dist/ask-run/host/db.js +126 -0
- package/dist/ask-run/host/ports.d.ts +35 -0
- package/dist/ask-run/host/ports.js +113 -0
- package/dist/ask-run/index.d.ts +13 -0
- package/dist/ask-run/index.js +35 -0
- package/dist/ask-run/replay.d.ts +128 -0
- package/dist/ask-run/replay.js +212 -0
- package/dist/ask-run/run-ask-eval.d.ts +125 -0
- package/dist/ask-run/run-ask-eval.js +193 -0
- package/dist/ask-run/seed-golden-graph.d.ts +64 -0
- package/dist/ask-run/seed-golden-graph.js +495 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/kg-command.d.ts +66 -0
- package/dist/cli/kg-command.js +238 -0
- package/dist/cli/main.d.ts +18 -0
- package/dist/cli/main.js +69 -0
- package/dist/fixtures/domains.d.ts +16 -0
- package/dist/fixtures/domains.js +33 -0
- package/dist/fixtures/fixture-schema.d.ts +323 -0
- package/dist/fixtures/fixture-schema.js +199 -0
- package/dist/fixtures/index.d.ts +16 -0
- package/dist/fixtures/index.js +40 -0
- package/dist/fixtures/load.d.ts +73 -0
- package/dist/fixtures/load.js +137 -0
- package/dist/fixtures/questions.d.ts +15 -0
- package/dist/fixtures/questions.js +26 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +36 -0
- package/dist/kg/gold-runner.d.ts +13 -0
- package/dist/kg/gold-runner.js +57 -0
- package/dist/kg/index.d.ts +17 -0
- package/dist/kg/index.js +65 -0
- package/dist/kg/internals.d.ts +7 -0
- package/dist/kg/internals.js +17 -0
- package/dist/kg/prediction-schema.d.ts +245 -0
- package/dist/kg/prediction-schema.js +102 -0
- package/dist/kg/predictions.d.ts +11 -0
- package/dist/kg/predictions.js +49 -0
- package/dist/kg/report.d.ts +84 -0
- package/dist/kg/report.js +125 -0
- package/dist/kg/run-kg-eval.d.ts +77 -0
- package/dist/kg/run-kg-eval.js +137 -0
- package/dist/kg/runner.d.ts +72 -0
- package/dist/kg/runner.js +51 -0
- package/dist/kg/runners/extract-resolve-runner.d.ts +40 -0
- package/dist/kg/runners/extract-resolve-runner.js +199 -0
- package/dist/kg/runners/extract-runner.d.ts +65 -0
- package/dist/kg/runners/extract-runner.js +243 -0
- package/dist/kg/scorer.d.ts +226 -0
- package/dist/kg/scorer.js +463 -0
- package/dist/kg/targets.d.ts +17 -0
- package/dist/kg/targets.js +16 -0
- package/dist/kg/text.d.ts +45 -0
- package/dist/kg/text.js +100 -0
- package/dist/live/adapters.d.ts +16 -0
- package/dist/live/adapters.js +58 -0
- package/dist/live/env.d.ts +39 -0
- package/dist/live/env.js +56 -0
- package/dist/live/index.d.ts +6 -0
- package/dist/live/index.js +16 -0
- package/dist/live/live-ai.d.ts +104 -0
- package/dist/live/live-ai.js +157 -0
- package/dist/parity/constants.d.ts +79 -0
- package/dist/parity/constants.js +104 -0
- package/dist/parity/index.d.ts +20 -0
- package/dist/parity/index.js +38 -0
- package/dist/parity/internals.d.ts +8 -0
- package/dist/parity/internals.js +16 -0
- package/dist/parity/scenario.d.ts +45 -0
- package/dist/parity/scenario.js +245 -0
- package/dist/parity/script.d.ts +44 -0
- package/dist/parity/script.js +136 -0
- package/dist/parity/snapshot.d.ts +43 -0
- package/dist/parity/snapshot.js +71 -0
- package/dist/real-data/index.d.ts +2 -0
- package/dist/real-data/index.js +12 -0
- package/dist/real-data/real-data.d.ts +76 -0
- package/dist/real-data/real-data.js +156 -0
- package/fixtures/kg-golden/README.md +136 -0
- package/fixtures/kg-golden/ask-questions.json +458 -0
- package/fixtures/kg-golden/meetings/m01-northwind-pilot-kickoff.json +792 -0
- package/fixtures/kg-golden/meetings/m02-halden-migration-planning.json +814 -0
- package/fixtures/kg-golden/meetings/m03-larkspur-weekly-sync.json +601 -0
- package/fixtures/kg-golden/meetings/m04-corvid-intake-discovery.json +690 -0
- package/fixtures/kg-golden/meetings/m05-hosting-vendor-selection.json +631 -0
- package/fixtures/kg-golden/meetings/m06-northwind-floor-data-review.json +649 -0
- package/fixtures/kg-golden/meetings/m07-gullwing-intro-notes.json +428 -0
- package/fixtures/kg-golden/meetings/m08-halden-migration-checkpoint.json +672 -0
- package/fixtures/kg-golden/meetings/m09-northwind-platform-org-update.json +711 -0
- package/fixtures/kg-golden/meetings/m10-corvid-prototype-review.json +623 -0
- package/fixtures/kg-golden/meetings/m11-solvane-grid-dashboard-scoping.json +689 -0
- package/fixtures/kg-golden/meetings/m12-northwind-pilot-replan.json +681 -0
- package/fixtures/kg-golden/meetings/m13-halden-cutover-go-no-go.json +721 -0
- package/fixtures/kg-golden/meetings/m14-gullwing-discovery-readout.json +719 -0
- package/fixtures/kg-golden/meetings/m15-halden-handover-ravi-leaving.json +716 -0
- package/fixtures/kg-golden/meetings/m16-varden-claims-portal-intro.json +704 -0
- package/fixtures/kg-golden/meetings/m17-corvid-usability-debrief.json +572 -0
- package/fixtures/kg-golden/meetings/m18-hosting-decision-revisited.json +655 -0
- package/fixtures/kg-golden/meetings/m19-solvane-integration-kickoff.json +726 -0
- package/fixtures/kg-golden/meetings/m20-northwind-go-live-retro.json +673 -0
- package/fixtures/kg-golden/meetings/m21-quarterly-account-review.json +449 -0
- package/fixtures/kg-golden/meetings/m22-halden-intro-call-2020.json +558 -0
- package/fixtures/kg-golden/meetings/m23-gullwing-model-review.json +702 -0
- package/fixtures/kg-golden/meetings/m24-varden-discovery-midpoint.json +643 -0
- package/fixtures/kg-golden/meetings/m25-corvid-rollout-planning.json +642 -0
- package/fixtures/kg-golden/meetings/m26-larkspur-engineering-prep.json +695 -0
- package/fixtures/kg-golden/meetings/m27-solvane-phase-one-demo.json +649 -0
- package/fixtures/kg-golden/meetings/m28-northwind-building-5-scoping.json +715 -0
- package/fixtures/kg-golden/meetings/m29-halden-southern-cutover-review.json +752 -0
- package/fixtures/kg-golden/meetings/m30-varden-portal-build-kickoff.json +697 -0
- package/fixtures/kg-golden/meetings/m31-gullwing-rollout-renewal.json +681 -0
- package/fixtures/kg-golden/meetings/m32-brambleway-weekly-sync.json +472 -0
- package/fixtures/kg-golden/meetings/m33-nina-oliver-one-on-one.json +342 -0
- package/fixtures/kg-golden/meetings/m34-coffee-with-dana.json +249 -0
- package/fixtures/kg-golden/meetings/m35-brambleway-june-sync.json +553 -0
- package/fixtures/kg-golden/meetings/m36-copenhagen-conference-planning.json +296 -0
- package/host/generated/client.d.ts +1 -0
- package/host/generated/client.js +5 -0
- package/host/generated/default.d.ts +1 -0
- package/host/generated/default.js +5 -0
- package/host/generated/edge.d.ts +1 -0
- package/host/generated/edge.js +1658 -0
- package/host/generated/index-browser.js +1684 -0
- package/host/generated/index.d.ts +192335 -0
- package/host/generated/index.js +1658 -0
- package/host/generated/package.json +139 -0
- package/host/generated/query_compiler_fast_bg.js +2 -0
- package/host/generated/query_compiler_fast_bg.wasm +0 -0
- package/host/generated/query_compiler_fast_bg.wasm-base64.js +2 -0
- package/host/generated/runtime/client.d.ts +3433 -0
- package/host/generated/runtime/client.js +110 -0
- package/host/generated/runtime/index-browser.d.ts +90 -0
- package/host/generated/runtime/index-browser.js +6 -0
- package/host/generated/runtime/wasm-compiler-edge.js +100 -0
- package/host/generated/schema.prisma +6312 -0
- package/host/generated/wasm-edge-light-loader.mjs +5 -0
- package/host/generated/wasm-worker-loader.mjs +5 -0
- package/host/prisma/fragments/kvox.ask.prisma +126 -0
- package/host/prisma/fragments/kvox.graph.prisma +1073 -0
- package/host/prisma/fragments/kvox.notes.prisma +787 -0
- package/host/prisma/fragments/kvox.search.prisma +211 -0
- package/host/prisma/fragments/kvox.transcripts.prisma +790 -0
- package/host/prisma/kvox.lock +101 -0
- package/host/prisma/migrations/20240101000000_initial/migration.sql +297 -0
- package/host/prisma/migrations/20240101000001_add_personal_access_tokens/migration.sql +31 -0
- package/host/prisma/migrations/20240101000002_add_credentials/migration.sql +20 -0
- package/host/prisma/migrations/20240101000003_add_notification_deliveries/migration.sql +27 -0
- package/host/prisma/migrations/20240101000004_drop_stale_uuid_defaults/migration.sql +35 -0
- package/host/prisma/migrations/20240101000005_add_notifications/migration.sql +22 -0
- package/host/prisma/migrations/20240101000006_add_push_subscriptions/migration.sql +25 -0
- package/host/prisma/migrations/20240101000007_add_jobs/migration.sql +110 -0
- package/host/prisma/migrations/20240101000008_add_worker_nodes/migration.sql +90 -0
- package/host/prisma/migrations/20240101000009_add_database_backup_runs/migration.sql +104 -0
- package/host/prisma/migrations/20240101000010_add_notification_broadcasts/migration.sql +57 -0
- package/host/prisma/migrations/20240101000011_add_backup_run_job_link/migration.sql +87 -0
- package/host/prisma/migrations/20240101000012_add_job_node_secrets/migration.sql +61 -0
- package/host/prisma/migrations/20240101000013_add_backup_run_pg_dump_version/migration.sql +26 -0
- package/host/prisma/migrations/20240101000014_add_job_claim_token/migration.sql +92 -0
- package/host/prisma/migrations/20240101000015_add_ai_platform/migration.sql +108 -0
- package/host/prisma/migrations/20240101000016_revoke_viewer_ai_use/migration.sql +32 -0
- package/host/prisma/migrations/20240101000017_add_user_credentials/migration.sql +29 -0
- package/host/prisma/migrations/20240101000018_add_device_session_credential_link/migration.sql +52 -0
- package/host/prisma/migrations/20240101000019_add_worker_node_vitals/migration.sql +3 -0
- package/host/prisma/migrations/20240101000020_add_job_trace_context/migration.sql +6 -0
- package/host/prisma/migrations/20240101000021_add_retention_created_at_indexes/migration.sql +13 -0
- package/host/prisma/migrations/20240101000022_add_organizations/migration.sql +142 -0
- package/host/prisma/migrations/20240101000023_split_system_org_roles/migration.sql +131 -0
- package/host/prisma/migrations/20240101000024_org_scoped_rls/migration.sql +215 -0
- package/host/prisma/migrations/20240101000025_add_groups/migration.sql +165 -0
- package/host/prisma/migrations/20240101000026_add_grants/migration.sql +117 -0
- package/host/prisma/migrations/20240101000027_add_org_settings/migration.sql +49 -0
- package/host/prisma/migrations/20240101000028_add_org_credentials/migration.sql +54 -0
- package/host/prisma/migrations/20240101000029_add_jobs_org_id/migration.sql +18 -0
- package/host/prisma/migrations/20240101000030_add_jobs_org_id_status_index/migration.sql +6 -0
- package/host/prisma/migrations/20240101000031_add_broadcast_target_org/migration.sql +21 -0
- package/host/prisma/migrations/20240101000032_add_android_app/migration.sql +60 -0
- package/host/prisma/migrations/20240101000033_open_job_reason/migration.sql +16 -0
- package/host/prisma/migrations/20240101000034_ai_usage_feature/migration.sql +37 -0
- package/host/prisma/migrations/20240101000035_add_app_metadata/migration.sql +49 -0
- package/host/prisma/migrations/20240101000036_open_sharing_vocabularies/migration.sql +97 -0
- package/host/prisma/migrations/20260914130000_kvox_add_transcripts/migration.sql +322 -0
- package/host/prisma/migrations/20260914140000_kvox_add_notes/migration.sql +311 -0
- package/host/prisma/migrations/20260915120000_kvox_add_search_vectors/migration.sql +150 -0
- package/host/prisma/migrations/20260915130000_kvox_add_search_embeddings/migration.sql +362 -0
- package/host/prisma/migrations/20260915210000_kvox_add_note_title_source/migration.sql +30 -0
- package/host/prisma/migrations/20260923120000_kvox_add_note_generation_context_snapshot/migration.sql +24 -0
- package/host/prisma/migrations/20260923130000_kvox_add_user_hidden_note_templates/migration.sql +35 -0
- package/host/prisma/migrations/20260923140000_kvox_add_transcript_speaker_identities/migration.sql +6 -0
- package/host/prisma/migrations/20260923150000_kvox_transcript_name_checks/migration.sql +95 -0
- package/host/prisma/migrations/20260923160000_kvox_add_note_body_format/migration.sql +27 -0
- package/host/prisma/migrations/20260923170000_kvox_add_note_version_body_format/migration.sql +23 -0
- package/host/prisma/migrations/20260926012548_kvox_add_knowledge_graph/migration.sql +680 -0
- package/host/prisma/migrations/20260926030000_kvox_fix_kg_relations_valid_precision_chk/migration.sql +29 -0
- package/host/prisma/migrations/20260926030100_kvox_add_transcript_recorded_at/migration.sql +9 -0
- package/host/prisma/migrations/20260926030200_kvox_kg_evidence_invariant/migration.sql +60 -0
- package/host/prisma/migrations/20260926040000_kvox_add_kg_graph_layouts/migration.sql +30 -0
- package/host/prisma/migrations/20260926050000_kvox_add_ask_conversations/migration.sql +99 -0
- package/host/prisma/migrations/20260926231512_kvox_add_kg_exports/migration.sql +52 -0
- package/host/prisma/migrations/20261016120000_kvox_transcripts_org_id/migration.sql +49 -0
- package/host/prisma/platform.lock +319 -0
- package/host/prisma/schema/app.kvox.ask.prisma +110 -0
- package/host/prisma/schema/app.kvox.graph.prisma +1030 -0
- package/host/prisma/schema/app.kvox.notes.prisma +746 -0
- package/host/prisma/schema/app.kvox.search.prisma +208 -0
- package/host/prisma/schema/app.kvox.transcripts.prisma +726 -0
- package/host/prisma/schema/platform.ai.prisma +419 -0
- package/host/prisma/schema/platform.android-app.prisma +46 -0
- package/host/prisma/schema/platform.base.prisma +15 -0
- package/host/prisma/schema/platform.credentials.prisma +156 -0
- package/host/prisma/schema/platform.db-backup.prisma +359 -0
- package/host/prisma/schema/platform.identity.prisma +638 -0
- package/host/prisma/schema/platform.jobs.prisma +824 -0
- package/host/prisma/schema/platform.notifications.prisma +641 -0
- package/host/prisma/schema/platform.settings.prisma +53 -0
- package/host/prisma/schema/platform.sharing.prisma +208 -0
- package/host/prisma/schema/platform.storage.prisma +118 -0
- package/package.json +112 -1
- package/parity/requests.ask.json +2681 -0
- package/parity/requests.m01.json +1554 -0
- package/parity/requests.m02.json +1554 -0
- package/parity/requests.m03.json +1554 -0
- package/parity/requests.m04.json +1554 -0
- package/parity/requests.m05.json +1554 -0
- package/parity/requests.m06.json +1554 -0
- package/parity/requests.m07.json +1554 -0
- package/parity/requests.m08.json +1554 -0
- package/parity/requests.m09.json +1554 -0
- package/parity/requests.m10.json +1554 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"kvoxDbVersion": "0.1.0-next.0",
|
|
3
|
+
"lockVersion": 1,
|
|
4
|
+
"migrations": [
|
|
5
|
+
{
|
|
6
|
+
"installedDir": "20260914130000_kvox_add_transcripts",
|
|
7
|
+
"originId": "kvox:20260914130000_add_transcripts",
|
|
8
|
+
"sha256": "0a78eea893b5e0e67e6b6b80c4c2656f9c4c461ae0759438eef9cbd733f08223"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"installedDir": "20260914140000_kvox_add_notes",
|
|
12
|
+
"originId": "kvox:20260914140000_add_notes",
|
|
13
|
+
"sha256": "eeb5fe7c56ebfe5e3d8aea76af7afae2eaf7d7c02eacf2f9caf11e26527bd3d5"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"installedDir": "20260915120000_kvox_add_search_vectors",
|
|
17
|
+
"originId": "kvox:20260915120000_add_search_vectors",
|
|
18
|
+
"sha256": "066c2b681e09084c886b2b72607598cadf2c914010cd7fc582fe4b2ddfb39391"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"installedDir": "20260915130000_kvox_add_search_embeddings",
|
|
22
|
+
"originId": "kvox:20260915130000_add_search_embeddings",
|
|
23
|
+
"sha256": "3f85c4cfd5c7de202379536034b071822964c44b98518dadda4435de1ed4240c"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"installedDir": "20260915210000_kvox_add_note_title_source",
|
|
27
|
+
"originId": "kvox:20260915210000_add_note_title_source",
|
|
28
|
+
"sha256": "1c79cfd8b1f273c4f953915aaab7040d8a915e34305b0f99d7e6bc4dcabf37b8"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"installedDir": "20260923120000_kvox_add_note_generation_context_snapshot",
|
|
32
|
+
"originId": "kvox:20260923120000_add_note_generation_context_snapshot",
|
|
33
|
+
"sha256": "3a6ab3da5bc4050ba09690f715448a942405289d8c034f3764821ff485068db2"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"installedDir": "20260923130000_kvox_add_user_hidden_note_templates",
|
|
37
|
+
"originId": "kvox:20260923130000_add_user_hidden_note_templates",
|
|
38
|
+
"sha256": "359dcd952a92974e06aab5cdc92818911794fbe607ff6a3ec23382e98a0f786a"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"installedDir": "20260923140000_kvox_add_transcript_speaker_identities",
|
|
42
|
+
"originId": "kvox:20260923140000_add_transcript_speaker_identities",
|
|
43
|
+
"sha256": "a253abb8a9fb1e7f34dcde273be49013b626176699ebbe4214de0c533e258d97"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"installedDir": "20260923150000_kvox_transcript_name_checks",
|
|
47
|
+
"originId": "kvox:20260923150000_transcript_name_checks",
|
|
48
|
+
"sha256": "0f1b5560c1b8fe09b06dd2329203561a1778a7425522ad6a56bd7a330844b6d0"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"installedDir": "20260923160000_kvox_add_note_body_format",
|
|
52
|
+
"originId": "kvox:20260923160000_add_note_body_format",
|
|
53
|
+
"sha256": "a5571257b9735f1b2c1f5c36774f1e9594a159aed005276ce9db82f9bc5d3aff"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"installedDir": "20260923170000_kvox_add_note_version_body_format",
|
|
57
|
+
"originId": "kvox:20260923170000_add_note_version_body_format",
|
|
58
|
+
"sha256": "a5e51e5531b8ad77c64973f09f0b6bb10e72e361c7f6d5d9d50d84fdb984600f"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"installedDir": "20260926012548_kvox_add_knowledge_graph",
|
|
62
|
+
"originId": "kvox:20260926012548_add_knowledge_graph",
|
|
63
|
+
"sha256": "06bc1ed4c520f562d9de450d1b5df70d023f5ecc2e242da8c1db812628dff5d6"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"installedDir": "20260926030000_kvox_fix_kg_relations_valid_precision_chk",
|
|
67
|
+
"originId": "kvox:20260926030000_fix_kg_relations_valid_precision_chk",
|
|
68
|
+
"sha256": "6dad1f229c4e73e7f415f15432f3da6bb1d5ce8364087605a2aa35800f23897f"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"installedDir": "20260926030100_kvox_add_transcript_recorded_at",
|
|
72
|
+
"originId": "kvox:20260926030100_add_transcript_recorded_at",
|
|
73
|
+
"sha256": "bbf280a0e3ed811e36ca1085341343fd6703c632bde2843c5c8b87b41a5f43a1"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"installedDir": "20260926030200_kvox_kg_evidence_invariant",
|
|
77
|
+
"originId": "kvox:20260926030200_kg_evidence_invariant",
|
|
78
|
+
"sha256": "13513f640879f8db8a4f2fe277f82042c8780e0ac652d33c6d5a004d644087bc"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"installedDir": "20260926040000_kvox_add_kg_graph_layouts",
|
|
82
|
+
"originId": "kvox:20260926040000_add_kg_graph_layouts",
|
|
83
|
+
"sha256": "259ade60065eb83603cf840fd4b6fc1bb3d6b190185784bbfbc2ac3bd886525a"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"installedDir": "20260926050000_kvox_add_ask_conversations",
|
|
87
|
+
"originId": "kvox:20260926050000_add_ask_conversations",
|
|
88
|
+
"sha256": "d3c81231df44c4b421eb936771a6361194ff5b66102c42b00ce5860867d90262"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"installedDir": "20260926231512_kvox_add_kg_exports",
|
|
92
|
+
"originId": "kvox:20260926231512_add_kg_exports",
|
|
93
|
+
"sha256": "cede3d7d9db346d38e82f9b070953093c0c5a22253a4a81a04ca884add4238bf"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"installedDir": "20261016120000_kvox_transcripts_org_id",
|
|
97
|
+
"originId": "kvox:20261016120000_transcripts_org_id",
|
|
98
|
+
"sha256": "a15ee44a552634c705bf5b408c26bf708427cd81e82de3f0f58218c022e4c9b0"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
-- CreateExtension
|
|
2
|
+
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
3
|
+
|
|
4
|
+
-- CreateEnum
|
|
5
|
+
CREATE TYPE "DeviceCodeStatus" AS ENUM ('pending', 'approved', 'denied', 'expired');
|
|
6
|
+
|
|
7
|
+
-- CreateEnum
|
|
8
|
+
CREATE TYPE "StorageObjectStatus" AS ENUM ('pending', 'uploading', 'processing', 'ready', 'failed');
|
|
9
|
+
|
|
10
|
+
-- CreateTable
|
|
11
|
+
CREATE TABLE "users" (
|
|
12
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
13
|
+
"email" TEXT NOT NULL,
|
|
14
|
+
"display_name" TEXT,
|
|
15
|
+
"provider_display_name" TEXT,
|
|
16
|
+
"profile_image_url" TEXT,
|
|
17
|
+
"provider_profile_image_url" TEXT,
|
|
18
|
+
"is_active" BOOLEAN NOT NULL DEFAULT true,
|
|
19
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
20
|
+
"updated_at" TIMESTAMPTZ NOT NULL,
|
|
21
|
+
|
|
22
|
+
CONSTRAINT "users_pkey" PRIMARY KEY ("id")
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
-- CreateTable
|
|
26
|
+
CREATE TABLE "user_identities" (
|
|
27
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
28
|
+
"user_id" UUID NOT NULL,
|
|
29
|
+
"provider" TEXT NOT NULL,
|
|
30
|
+
"provider_subject" TEXT NOT NULL,
|
|
31
|
+
"provider_email" TEXT,
|
|
32
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
33
|
+
|
|
34
|
+
CONSTRAINT "user_identities_pkey" PRIMARY KEY ("id")
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
-- CreateTable
|
|
38
|
+
CREATE TABLE "roles" (
|
|
39
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
40
|
+
"name" TEXT NOT NULL,
|
|
41
|
+
"description" TEXT,
|
|
42
|
+
|
|
43
|
+
CONSTRAINT "roles_pkey" PRIMARY KEY ("id")
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
-- CreateTable
|
|
47
|
+
CREATE TABLE "permissions" (
|
|
48
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
49
|
+
"name" TEXT NOT NULL,
|
|
50
|
+
"description" TEXT,
|
|
51
|
+
|
|
52
|
+
CONSTRAINT "permissions_pkey" PRIMARY KEY ("id")
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
-- CreateTable
|
|
56
|
+
CREATE TABLE "role_permissions" (
|
|
57
|
+
"role_id" UUID NOT NULL,
|
|
58
|
+
"permission_id" UUID NOT NULL,
|
|
59
|
+
|
|
60
|
+
CONSTRAINT "role_permissions_pkey" PRIMARY KEY ("role_id","permission_id")
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
-- CreateTable
|
|
64
|
+
CREATE TABLE "user_roles" (
|
|
65
|
+
"user_id" UUID NOT NULL,
|
|
66
|
+
"role_id" UUID NOT NULL,
|
|
67
|
+
|
|
68
|
+
CONSTRAINT "user_roles_pkey" PRIMARY KEY ("user_id","role_id")
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
-- CreateTable
|
|
72
|
+
CREATE TABLE "system_settings" (
|
|
73
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
74
|
+
"key" TEXT NOT NULL,
|
|
75
|
+
"value" JSONB NOT NULL,
|
|
76
|
+
"version" INTEGER NOT NULL DEFAULT 1,
|
|
77
|
+
"updated_by_user_id" UUID,
|
|
78
|
+
"updated_at" TIMESTAMPTZ NOT NULL,
|
|
79
|
+
|
|
80
|
+
CONSTRAINT "system_settings_pkey" PRIMARY KEY ("id")
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
-- CreateTable
|
|
84
|
+
CREATE TABLE "user_settings" (
|
|
85
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
86
|
+
"user_id" UUID NOT NULL,
|
|
87
|
+
"value" JSONB NOT NULL,
|
|
88
|
+
"version" INTEGER NOT NULL DEFAULT 1,
|
|
89
|
+
"updated_at" TIMESTAMPTZ NOT NULL,
|
|
90
|
+
|
|
91
|
+
CONSTRAINT "user_settings_pkey" PRIMARY KEY ("id")
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
-- CreateTable
|
|
95
|
+
CREATE TABLE "audit_events" (
|
|
96
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
97
|
+
"actor_user_id" UUID,
|
|
98
|
+
"action" TEXT NOT NULL,
|
|
99
|
+
"target_type" TEXT NOT NULL,
|
|
100
|
+
"target_id" TEXT NOT NULL,
|
|
101
|
+
"meta" JSONB,
|
|
102
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
103
|
+
|
|
104
|
+
CONSTRAINT "audit_events_pkey" PRIMARY KEY ("id")
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
-- CreateTable
|
|
108
|
+
CREATE TABLE "refresh_tokens" (
|
|
109
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
110
|
+
"user_id" UUID NOT NULL,
|
|
111
|
+
"token_hash" TEXT NOT NULL,
|
|
112
|
+
"expires_at" TIMESTAMPTZ NOT NULL,
|
|
113
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
114
|
+
"revoked_at" TIMESTAMPTZ,
|
|
115
|
+
|
|
116
|
+
CONSTRAINT "refresh_tokens_pkey" PRIMARY KEY ("id")
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
-- CreateTable
|
|
120
|
+
CREATE TABLE "allowed_emails" (
|
|
121
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
122
|
+
"email" TEXT NOT NULL,
|
|
123
|
+
"added_by_id" UUID,
|
|
124
|
+
"added_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
125
|
+
"claimed_by_id" UUID,
|
|
126
|
+
"claimed_at" TIMESTAMPTZ,
|
|
127
|
+
"notes" TEXT,
|
|
128
|
+
|
|
129
|
+
CONSTRAINT "allowed_emails_pkey" PRIMARY KEY ("id")
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
-- CreateTable
|
|
133
|
+
CREATE TABLE "device_codes" (
|
|
134
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
135
|
+
"device_code" TEXT NOT NULL,
|
|
136
|
+
"user_code" TEXT NOT NULL,
|
|
137
|
+
"user_id" UUID,
|
|
138
|
+
"status" "DeviceCodeStatus" NOT NULL DEFAULT 'pending',
|
|
139
|
+
"client_info" JSONB,
|
|
140
|
+
"scopes" TEXT[],
|
|
141
|
+
"expires_at" TIMESTAMPTZ NOT NULL,
|
|
142
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
143
|
+
"updated_at" TIMESTAMPTZ NOT NULL,
|
|
144
|
+
|
|
145
|
+
CONSTRAINT "device_codes_pkey" PRIMARY KEY ("id")
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
-- CreateTable
|
|
149
|
+
CREATE TABLE "storage_objects" (
|
|
150
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
151
|
+
"name" TEXT NOT NULL,
|
|
152
|
+
"size" BIGINT NOT NULL,
|
|
153
|
+
"mime_type" TEXT NOT NULL,
|
|
154
|
+
"storage_key" TEXT NOT NULL,
|
|
155
|
+
"storage_provider" TEXT NOT NULL DEFAULT 's3',
|
|
156
|
+
"bucket" TEXT,
|
|
157
|
+
"status" "StorageObjectStatus" NOT NULL DEFAULT 'pending',
|
|
158
|
+
"s3_upload_id" TEXT,
|
|
159
|
+
"metadata" JSONB,
|
|
160
|
+
"uploaded_by_id" UUID,
|
|
161
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
162
|
+
"updated_at" TIMESTAMPTZ NOT NULL,
|
|
163
|
+
|
|
164
|
+
CONSTRAINT "storage_objects_pkey" PRIMARY KEY ("id")
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
-- CreateTable
|
|
168
|
+
CREATE TABLE "storage_object_chunks" (
|
|
169
|
+
"id" UUID NOT NULL DEFAULT uuid_generate_v4(),
|
|
170
|
+
"object_id" UUID NOT NULL,
|
|
171
|
+
"part_number" INTEGER NOT NULL,
|
|
172
|
+
"e_tag" TEXT NOT NULL,
|
|
173
|
+
"size" BIGINT NOT NULL,
|
|
174
|
+
"uploaded_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
175
|
+
|
|
176
|
+
CONSTRAINT "storage_object_chunks_pkey" PRIMARY KEY ("id")
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
-- CreateIndex
|
|
180
|
+
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
|
|
181
|
+
|
|
182
|
+
-- CreateIndex
|
|
183
|
+
CREATE UNIQUE INDEX "user_identities_provider_provider_subject_key" ON "user_identities"("provider", "provider_subject");
|
|
184
|
+
|
|
185
|
+
-- CreateIndex
|
|
186
|
+
CREATE UNIQUE INDEX "roles_name_key" ON "roles"("name");
|
|
187
|
+
|
|
188
|
+
-- CreateIndex
|
|
189
|
+
CREATE UNIQUE INDEX "permissions_name_key" ON "permissions"("name");
|
|
190
|
+
|
|
191
|
+
-- CreateIndex
|
|
192
|
+
CREATE UNIQUE INDEX "system_settings_key_key" ON "system_settings"("key");
|
|
193
|
+
|
|
194
|
+
-- CreateIndex
|
|
195
|
+
CREATE UNIQUE INDEX "user_settings_user_id_key" ON "user_settings"("user_id");
|
|
196
|
+
|
|
197
|
+
-- CreateIndex
|
|
198
|
+
CREATE INDEX "audit_events_actor_user_id_idx" ON "audit_events"("actor_user_id");
|
|
199
|
+
|
|
200
|
+
-- CreateIndex
|
|
201
|
+
CREATE INDEX "audit_events_target_type_target_id_idx" ON "audit_events"("target_type", "target_id");
|
|
202
|
+
|
|
203
|
+
-- CreateIndex
|
|
204
|
+
CREATE INDEX "audit_events_created_at_idx" ON "audit_events"("created_at");
|
|
205
|
+
|
|
206
|
+
-- CreateIndex
|
|
207
|
+
CREATE UNIQUE INDEX "refresh_tokens_token_hash_key" ON "refresh_tokens"("token_hash");
|
|
208
|
+
|
|
209
|
+
-- CreateIndex
|
|
210
|
+
CREATE INDEX "refresh_tokens_user_id_idx" ON "refresh_tokens"("user_id");
|
|
211
|
+
|
|
212
|
+
-- CreateIndex
|
|
213
|
+
CREATE INDEX "refresh_tokens_expires_at_idx" ON "refresh_tokens"("expires_at");
|
|
214
|
+
|
|
215
|
+
-- CreateIndex
|
|
216
|
+
CREATE UNIQUE INDEX "allowed_emails_email_key" ON "allowed_emails"("email");
|
|
217
|
+
|
|
218
|
+
-- CreateIndex
|
|
219
|
+
CREATE UNIQUE INDEX "allowed_emails_claimed_by_id_key" ON "allowed_emails"("claimed_by_id");
|
|
220
|
+
|
|
221
|
+
-- CreateIndex
|
|
222
|
+
CREATE UNIQUE INDEX "device_codes_device_code_key" ON "device_codes"("device_code");
|
|
223
|
+
|
|
224
|
+
-- CreateIndex
|
|
225
|
+
CREATE UNIQUE INDEX "device_codes_user_code_key" ON "device_codes"("user_code");
|
|
226
|
+
|
|
227
|
+
-- CreateIndex
|
|
228
|
+
CREATE INDEX "device_codes_device_code_idx" ON "device_codes"("device_code");
|
|
229
|
+
|
|
230
|
+
-- CreateIndex
|
|
231
|
+
CREATE INDEX "device_codes_user_code_idx" ON "device_codes"("user_code");
|
|
232
|
+
|
|
233
|
+
-- CreateIndex
|
|
234
|
+
CREATE INDEX "device_codes_status_expires_at_idx" ON "device_codes"("status", "expires_at");
|
|
235
|
+
|
|
236
|
+
-- CreateIndex
|
|
237
|
+
CREATE INDEX "device_codes_user_id_idx" ON "device_codes"("user_id");
|
|
238
|
+
|
|
239
|
+
-- CreateIndex
|
|
240
|
+
CREATE UNIQUE INDEX "storage_objects_storage_key_key" ON "storage_objects"("storage_key");
|
|
241
|
+
|
|
242
|
+
-- CreateIndex
|
|
243
|
+
CREATE INDEX "storage_objects_uploaded_by_id_idx" ON "storage_objects"("uploaded_by_id");
|
|
244
|
+
|
|
245
|
+
-- CreateIndex
|
|
246
|
+
CREATE INDEX "storage_objects_status_idx" ON "storage_objects"("status");
|
|
247
|
+
|
|
248
|
+
-- CreateIndex
|
|
249
|
+
CREATE INDEX "storage_objects_created_at_idx" ON "storage_objects"("created_at");
|
|
250
|
+
|
|
251
|
+
-- CreateIndex
|
|
252
|
+
CREATE UNIQUE INDEX "storage_object_chunks_object_id_part_number_key" ON "storage_object_chunks"("object_id", "part_number");
|
|
253
|
+
|
|
254
|
+
-- CreateIndex
|
|
255
|
+
CREATE INDEX "storage_object_chunks_object_id_idx" ON "storage_object_chunks"("object_id");
|
|
256
|
+
|
|
257
|
+
-- AddForeignKey
|
|
258
|
+
ALTER TABLE "user_identities" ADD CONSTRAINT "user_identities_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
259
|
+
|
|
260
|
+
-- AddForeignKey
|
|
261
|
+
ALTER TABLE "role_permissions" ADD CONSTRAINT "role_permissions_role_id_fkey" FOREIGN KEY ("role_id") REFERENCES "roles"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
262
|
+
|
|
263
|
+
-- AddForeignKey
|
|
264
|
+
ALTER TABLE "role_permissions" ADD CONSTRAINT "role_permissions_permission_id_fkey" FOREIGN KEY ("permission_id") REFERENCES "permissions"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
265
|
+
|
|
266
|
+
-- AddForeignKey
|
|
267
|
+
ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
268
|
+
|
|
269
|
+
-- AddForeignKey
|
|
270
|
+
ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_role_id_fkey" FOREIGN KEY ("role_id") REFERENCES "roles"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
271
|
+
|
|
272
|
+
-- AddForeignKey
|
|
273
|
+
ALTER TABLE "system_settings" ADD CONSTRAINT "system_settings_updated_by_user_id_fkey" FOREIGN KEY ("updated_by_user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
274
|
+
|
|
275
|
+
-- AddForeignKey
|
|
276
|
+
ALTER TABLE "user_settings" ADD CONSTRAINT "user_settings_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
277
|
+
|
|
278
|
+
-- AddForeignKey
|
|
279
|
+
ALTER TABLE "audit_events" ADD CONSTRAINT "audit_events_actor_user_id_fkey" FOREIGN KEY ("actor_user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
280
|
+
|
|
281
|
+
-- AddForeignKey
|
|
282
|
+
ALTER TABLE "refresh_tokens" ADD CONSTRAINT "refresh_tokens_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
283
|
+
|
|
284
|
+
-- AddForeignKey
|
|
285
|
+
ALTER TABLE "allowed_emails" ADD CONSTRAINT "allowed_emails_added_by_id_fkey" FOREIGN KEY ("added_by_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
286
|
+
|
|
287
|
+
-- AddForeignKey
|
|
288
|
+
ALTER TABLE "allowed_emails" ADD CONSTRAINT "allowed_emails_claimed_by_id_fkey" FOREIGN KEY ("claimed_by_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
289
|
+
|
|
290
|
+
-- AddForeignKey
|
|
291
|
+
ALTER TABLE "device_codes" ADD CONSTRAINT "device_codes_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
292
|
+
|
|
293
|
+
-- AddForeignKey
|
|
294
|
+
ALTER TABLE "storage_objects" ADD CONSTRAINT "storage_objects_uploaded_by_id_fkey" FOREIGN KEY ("uploaded_by_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
295
|
+
|
|
296
|
+
-- AddForeignKey
|
|
297
|
+
ALTER TABLE "storage_object_chunks" ADD CONSTRAINT "storage_object_chunks_object_id_fkey" FOREIGN KEY ("object_id") REFERENCES "storage_objects"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "PatDurationUnit" AS ENUM ('minutes', 'days', 'months');
|
|
3
|
+
|
|
4
|
+
-- CreateTable
|
|
5
|
+
CREATE TABLE "personal_access_tokens" (
|
|
6
|
+
"id" UUID NOT NULL,
|
|
7
|
+
"user_id" UUID NOT NULL,
|
|
8
|
+
"name" TEXT NOT NULL,
|
|
9
|
+
"token_hash" TEXT NOT NULL,
|
|
10
|
+
"token_prefix" TEXT NOT NULL,
|
|
11
|
+
"duration_value" INTEGER NOT NULL,
|
|
12
|
+
"duration_unit" "PatDurationUnit" NOT NULL,
|
|
13
|
+
"expires_at" TIMESTAMPTZ NOT NULL,
|
|
14
|
+
"last_used_at" TIMESTAMPTZ,
|
|
15
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
16
|
+
"revoked_at" TIMESTAMPTZ,
|
|
17
|
+
|
|
18
|
+
CONSTRAINT "personal_access_tokens_pkey" PRIMARY KEY ("id")
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
-- CreateIndex
|
|
22
|
+
CREATE UNIQUE INDEX "personal_access_tokens_token_hash_key" ON "personal_access_tokens"("token_hash");
|
|
23
|
+
|
|
24
|
+
-- CreateIndex
|
|
25
|
+
CREATE INDEX "personal_access_tokens_user_id_idx" ON "personal_access_tokens"("user_id");
|
|
26
|
+
|
|
27
|
+
-- CreateIndex
|
|
28
|
+
CREATE INDEX "personal_access_tokens_expires_at_idx" ON "personal_access_tokens"("expires_at");
|
|
29
|
+
|
|
30
|
+
-- AddForeignKey
|
|
31
|
+
ALTER TABLE "personal_access_tokens" ADD CONSTRAINT "personal_access_tokens_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "credentials" (
|
|
3
|
+
"id" UUID NOT NULL,
|
|
4
|
+
"purpose" TEXT NOT NULL,
|
|
5
|
+
"name" TEXT NOT NULL,
|
|
6
|
+
"secret" TEXT NOT NULL,
|
|
7
|
+
"hint" TEXT,
|
|
8
|
+
"label" TEXT,
|
|
9
|
+
"updated_by_user_id" UUID,
|
|
10
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
11
|
+
"updated_at" TIMESTAMPTZ NOT NULL,
|
|
12
|
+
|
|
13
|
+
CONSTRAINT "credentials_pkey" PRIMARY KEY ("id")
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
-- CreateIndex
|
|
17
|
+
CREATE UNIQUE INDEX "credentials_purpose_name_key" ON "credentials"("purpose", "name");
|
|
18
|
+
|
|
19
|
+
-- AddForeignKey
|
|
20
|
+
ALTER TABLE "credentials" ADD CONSTRAINT "credentials_updated_by_user_id_fkey" FOREIGN KEY ("updated_by_user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "NotificationDeliveryStatus" AS ENUM ('queued', 'sent', 'failed');
|
|
3
|
+
|
|
4
|
+
-- CreateTable
|
|
5
|
+
CREATE TABLE "notification_deliveries" (
|
|
6
|
+
"id" UUID NOT NULL,
|
|
7
|
+
"event_key" TEXT NOT NULL,
|
|
8
|
+
"user_id" UUID,
|
|
9
|
+
"recipient" TEXT NOT NULL,
|
|
10
|
+
"channel" TEXT NOT NULL,
|
|
11
|
+
"status" "NotificationDeliveryStatus" NOT NULL DEFAULT 'queued',
|
|
12
|
+
"provider_message_id" TEXT,
|
|
13
|
+
"error" TEXT,
|
|
14
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
15
|
+
"updated_at" TIMESTAMPTZ NOT NULL,
|
|
16
|
+
|
|
17
|
+
CONSTRAINT "notification_deliveries_pkey" PRIMARY KEY ("id")
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
-- CreateIndex
|
|
21
|
+
CREATE INDEX "notification_deliveries_user_id_event_key_idx" ON "notification_deliveries"("user_id", "event_key");
|
|
22
|
+
|
|
23
|
+
-- CreateIndex
|
|
24
|
+
CREATE INDEX "notification_deliveries_status_created_at_idx" ON "notification_deliveries"("status", "created_at");
|
|
25
|
+
|
|
26
|
+
-- AddForeignKey
|
|
27
|
+
ALTER TABLE "notification_deliveries" ADD CONSTRAINT "notification_deliveries_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE "allowed_emails" ALTER COLUMN "id" DROP DEFAULT;
|
|
3
|
+
|
|
4
|
+
-- AlterTable
|
|
5
|
+
ALTER TABLE "audit_events" ALTER COLUMN "id" DROP DEFAULT;
|
|
6
|
+
|
|
7
|
+
-- AlterTable
|
|
8
|
+
ALTER TABLE "device_codes" ALTER COLUMN "id" DROP DEFAULT;
|
|
9
|
+
|
|
10
|
+
-- AlterTable
|
|
11
|
+
ALTER TABLE "permissions" ALTER COLUMN "id" DROP DEFAULT;
|
|
12
|
+
|
|
13
|
+
-- AlterTable
|
|
14
|
+
ALTER TABLE "refresh_tokens" ALTER COLUMN "id" DROP DEFAULT;
|
|
15
|
+
|
|
16
|
+
-- AlterTable
|
|
17
|
+
ALTER TABLE "roles" ALTER COLUMN "id" DROP DEFAULT;
|
|
18
|
+
|
|
19
|
+
-- AlterTable
|
|
20
|
+
ALTER TABLE "storage_object_chunks" ALTER COLUMN "id" DROP DEFAULT;
|
|
21
|
+
|
|
22
|
+
-- AlterTable
|
|
23
|
+
ALTER TABLE "storage_objects" ALTER COLUMN "id" DROP DEFAULT;
|
|
24
|
+
|
|
25
|
+
-- AlterTable
|
|
26
|
+
ALTER TABLE "system_settings" ALTER COLUMN "id" DROP DEFAULT;
|
|
27
|
+
|
|
28
|
+
-- AlterTable
|
|
29
|
+
ALTER TABLE "user_identities" ALTER COLUMN "id" DROP DEFAULT;
|
|
30
|
+
|
|
31
|
+
-- AlterTable
|
|
32
|
+
ALTER TABLE "user_settings" ALTER COLUMN "id" DROP DEFAULT;
|
|
33
|
+
|
|
34
|
+
-- AlterTable
|
|
35
|
+
ALTER TABLE "users" ALTER COLUMN "id" DROP DEFAULT;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "notifications" (
|
|
3
|
+
"id" UUID NOT NULL,
|
|
4
|
+
"user_id" UUID NOT NULL,
|
|
5
|
+
"event_key" TEXT NOT NULL,
|
|
6
|
+
"title" TEXT NOT NULL,
|
|
7
|
+
"body" TEXT NOT NULL,
|
|
8
|
+
"link" TEXT,
|
|
9
|
+
"read_at" TIMESTAMPTZ,
|
|
10
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
11
|
+
|
|
12
|
+
CONSTRAINT "notifications_pkey" PRIMARY KEY ("id")
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
-- CreateIndex
|
|
16
|
+
CREATE INDEX "notifications_user_id_read_at_idx" ON "notifications"("user_id", "read_at");
|
|
17
|
+
|
|
18
|
+
-- CreateIndex
|
|
19
|
+
CREATE INDEX "notifications_user_id_created_at_idx" ON "notifications"("user_id", "created_at" DESC);
|
|
20
|
+
|
|
21
|
+
-- AddForeignKey
|
|
22
|
+
ALTER TABLE "notifications" ADD CONSTRAINT "notifications_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "push_subscriptions" (
|
|
3
|
+
"id" UUID NOT NULL,
|
|
4
|
+
"user_id" UUID NOT NULL,
|
|
5
|
+
"endpoint" TEXT NOT NULL,
|
|
6
|
+
"p256dh" TEXT NOT NULL,
|
|
7
|
+
"auth" TEXT NOT NULL,
|
|
8
|
+
"expiration_time" TIMESTAMPTZ,
|
|
9
|
+
"user_agent" TEXT,
|
|
10
|
+
"failure_count" INTEGER NOT NULL DEFAULT 0,
|
|
11
|
+
"last_success_at" TIMESTAMPTZ,
|
|
12
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
13
|
+
"updated_at" TIMESTAMPTZ NOT NULL,
|
|
14
|
+
|
|
15
|
+
CONSTRAINT "push_subscriptions_pkey" PRIMARY KEY ("id")
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
-- CreateIndex
|
|
19
|
+
CREATE UNIQUE INDEX "push_subscriptions_endpoint_key" ON "push_subscriptions"("endpoint");
|
|
20
|
+
|
|
21
|
+
-- CreateIndex
|
|
22
|
+
CREATE INDEX "push_subscriptions_user_id_idx" ON "push_subscriptions"("user_id");
|
|
23
|
+
|
|
24
|
+
-- AddForeignKey
|
|
25
|
+
ALTER TABLE "push_subscriptions" ADD CONSTRAINT "push_subscriptions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "JobStatus" AS ENUM ('pending', 'running', 'succeeded', 'failed');
|
|
3
|
+
|
|
4
|
+
-- CreateEnum
|
|
5
|
+
CREATE TYPE "JobReason" AS ENUM ('upload', 'rerun', 'backfill');
|
|
6
|
+
|
|
7
|
+
-- CreateTable
|
|
8
|
+
CREATE TABLE "jobs" (
|
|
9
|
+
"id" UUID NOT NULL,
|
|
10
|
+
"type" TEXT NOT NULL,
|
|
11
|
+
"subject_type" TEXT,
|
|
12
|
+
"subject_id" TEXT,
|
|
13
|
+
"dedup_key" TEXT,
|
|
14
|
+
"status" "JobStatus" NOT NULL DEFAULT 'pending',
|
|
15
|
+
"reason" "JobReason" NOT NULL,
|
|
16
|
+
"priority" INTEGER NOT NULL DEFAULT 0,
|
|
17
|
+
"provider_key" TEXT,
|
|
18
|
+
"model_version" TEXT,
|
|
19
|
+
"payload" JSONB,
|
|
20
|
+
"attempts" INTEGER NOT NULL DEFAULT 0,
|
|
21
|
+
"last_error" TEXT,
|
|
22
|
+
"created_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
23
|
+
"started_at" TIMESTAMPTZ,
|
|
24
|
+
"finished_at" TIMESTAMPTZ,
|
|
25
|
+
"scheduled_for" TIMESTAMPTZ,
|
|
26
|
+
"rate_limited_at" TIMESTAMPTZ,
|
|
27
|
+
"rate_limit_hits" INTEGER NOT NULL DEFAULT 0,
|
|
28
|
+
"claimed_by_node_id" UUID,
|
|
29
|
+
"lease_expires_at" TIMESTAMPTZ,
|
|
30
|
+
"executor" TEXT,
|
|
31
|
+
|
|
32
|
+
CONSTRAINT "jobs_pkey" PRIMARY KEY ("id")
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
-- CreateTable
|
|
36
|
+
CREATE TABLE "job_stats_rollup" (
|
|
37
|
+
"type" TEXT NOT NULL,
|
|
38
|
+
"succeeded_count" INTEGER NOT NULL DEFAULT 0,
|
|
39
|
+
"failed_count" INTEGER NOT NULL DEFAULT 0,
|
|
40
|
+
"sum_duration_ms" DOUBLE PRECISION NOT NULL DEFAULT 0,
|
|
41
|
+
"duration_samples" INTEGER NOT NULL DEFAULT 0,
|
|
42
|
+
"updated_at" TIMESTAMPTZ NOT NULL,
|
|
43
|
+
|
|
44
|
+
CONSTRAINT "job_stats_rollup_pkey" PRIMARY KEY ("type")
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
-- CreateIndex
|
|
48
|
+
CREATE INDEX "jobs_status_priority_created_at_idx" ON "jobs"("status", "priority", "created_at");
|
|
49
|
+
|
|
50
|
+
-- CreateIndex
|
|
51
|
+
CREATE INDEX "jobs_status_scheduled_for_priority_created_at_idx" ON "jobs"("status", "scheduled_for", "priority", "created_at");
|
|
52
|
+
|
|
53
|
+
-- CreateIndex
|
|
54
|
+
CREATE INDEX "jobs_subject_type_subject_id_idx" ON "jobs"("subject_type", "subject_id");
|
|
55
|
+
|
|
56
|
+
-- CreateIndex
|
|
57
|
+
CREATE INDEX "jobs_type_status_idx" ON "jobs"("type", "status");
|
|
58
|
+
|
|
59
|
+
-- CreateIndex
|
|
60
|
+
CREATE INDEX "jobs_status_lease_expires_at_idx" ON "jobs"("status", "lease_expires_at");
|
|
61
|
+
|
|
62
|
+
-- CreateIndex
|
|
63
|
+
CREATE INDEX "jobs_claimed_by_node_id_idx" ON "jobs"("claimed_by_node_id");
|
|
64
|
+
|
|
65
|
+
-- CreateIndex
|
|
66
|
+
CREATE INDEX "jobs_created_at_idx" ON "jobs"("created_at" DESC);
|
|
67
|
+
|
|
68
|
+
-- CreateIndex
|
|
69
|
+
-- Covering index for the two unconditional admin groupBy({ by: ['status'] })-
|
|
70
|
+
-- shaped counts: status, type and id are the only columns those queries read,
|
|
71
|
+
-- so Postgres can answer them as an index-only scan without visiting the heap.
|
|
72
|
+
CREATE INDEX "jobs_status_type_id_idx" ON "jobs"("status", "type", "id");
|
|
73
|
+
|
|
74
|
+
-- =============================================================================
|
|
75
|
+
-- HAND-WRITTEN INDEXES — INTENTIONAL SCHEMA DRIFT (issue #255, epic #254)
|
|
76
|
+
-- =============================================================================
|
|
77
|
+
-- The three indexes below are NOT emitted by `prisma migrate dev`/`diff` and
|
|
78
|
+
-- never will be: each needs a partial-index `WHERE` clause, which the Prisma
|
|
79
|
+
-- schema language has no syntax for. They are written here by hand, and the
|
|
80
|
+
-- block comment above the `Job` model in prisma/schema.prisma records the
|
|
81
|
+
-- same fact for anyone reading the schema without this file open. Do not
|
|
82
|
+
-- "reconcile" this migration by dropping them, and do not expect `prisma
|
|
83
|
+
-- migrate diff` against the live database to come back clean — this drift is
|
|
84
|
+
-- deliberate and permanent for as long as Prisma's DSL lacks partial indexes.
|
|
85
|
+
-- =============================================================================
|
|
86
|
+
|
|
87
|
+
-- Enforces the active-dedup constraint described at length above the `Job`
|
|
88
|
+
-- model in prisma/schema.prisma ("dedupKey / the active-dedup unique index").
|
|
89
|
+
-- The key format itself is defined once in buildDedupKey()
|
|
90
|
+
-- (apps/api/src/jobs/job-keys.ts) — this index does not care how the string
|
|
91
|
+
-- was built, only that it is unique among jobs that are still active.
|
|
92
|
+
-- `dedup_key IS NOT NULL` lets jobs that opt out of dedup (a NULL key) insert
|
|
93
|
+
-- freely; the status filter is what makes a key reusable once its job
|
|
94
|
+
-- finishes (succeeded or failed jobs drop out of this index's predicate).
|
|
95
|
+
CREATE UNIQUE INDEX "jobs_active_dedup_uniq_idx"
|
|
96
|
+
ON "jobs"("dedup_key") WHERE "status" IN ('pending','running') AND "dedup_key" IS NOT NULL;
|
|
97
|
+
|
|
98
|
+
-- "Show me flaky jobs" without indexing the (large) majority that succeeded
|
|
99
|
+
-- on their first attempt. See "attempts vs rateLimitedAt/rateLimitHits" above
|
|
100
|
+
-- the `Job` model for why `attempts` and rate-limit deferrals are counted
|
|
101
|
+
-- separately in the first place.
|
|
102
|
+
CREATE INDEX "jobs_attempts_gt1_idx" ON "jobs"("attempts") WHERE "attempts" > 1;
|
|
103
|
+
|
|
104
|
+
-- Feeds the per-type duration stats that `JobStatsRollup` accumulates:
|
|
105
|
+
-- only jobs that actually reached `succeeded` with both timestamps recorded
|
|
106
|
+
-- have a meaningful duration, so the index is scoped to exactly those rows
|
|
107
|
+
-- rather than the full table.
|
|
108
|
+
CREATE INDEX "jobs_succeeded_duration_idx"
|
|
109
|
+
ON "jobs"("finished_at","started_at","type")
|
|
110
|
+
WHERE "status"='succeeded' AND "started_at" IS NOT NULL AND "finished_at" IS NOT NULL;
|