@marinoscar/platform-db 0.0.0-stage → 0.1.0-next.11
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 +88 -0
- package/LICENSE +21 -0
- package/README.md +525 -2
- package/bin/platform.js +28 -0
- package/dist/baseline/deps.d.ts +32 -0
- package/dist/baseline/deps.d.ts.map +1 -0
- package/dist/baseline/deps.js +66 -0
- package/dist/baseline/deps.js.map +1 -0
- package/dist/baseline/errors.d.ts +36 -0
- package/dist/baseline/errors.d.ts.map +1 -0
- package/dist/baseline/errors.js +23 -0
- package/dist/baseline/errors.js.map +1 -0
- package/dist/baseline/fs.d.ts +9 -0
- package/dist/baseline/fs.d.ts.map +1 -0
- package/dist/baseline/fs.js +39 -0
- package/dist/baseline/fs.js.map +1 -0
- package/dist/baseline/index.d.ts +8 -0
- package/dist/baseline/index.d.ts.map +1 -0
- package/dist/baseline/index.js +24 -0
- package/dist/baseline/index.js.map +1 -0
- package/dist/baseline/mapping.d.ts +43 -0
- package/dist/baseline/mapping.d.ts.map +1 -0
- package/dist/baseline/mapping.js +80 -0
- package/dist/baseline/mapping.js.map +1 -0
- package/dist/baseline/normalise.d.ts +42 -0
- package/dist/baseline/normalise.d.ts.map +1 -0
- package/dist/baseline/normalise.js +133 -0
- package/dist/baseline/normalise.js.map +1 -0
- package/dist/baseline/plan.d.ts +66 -0
- package/dist/baseline/plan.d.ts.map +1 -0
- package/dist/baseline/plan.js +105 -0
- package/dist/baseline/plan.js.map +1 -0
- package/dist/baseline/report.d.ts +127 -0
- package/dist/baseline/report.d.ts.map +1 -0
- package/dist/baseline/report.js +89 -0
- package/dist/baseline/report.js.map +1 -0
- package/dist/baseline/run.d.ts +117 -0
- package/dist/baseline/run.d.ts.map +1 -0
- package/dist/baseline/run.js +358 -0
- package/dist/baseline/run.js.map +1 -0
- package/dist/bin/db-commands.d.ts +31 -0
- package/dist/bin/db-commands.d.ts.map +1 -0
- package/dist/bin/db-commands.js +311 -0
- package/dist/bin/db-commands.js.map +1 -0
- package/dist/bin/fs-io.d.ts +7 -0
- package/dist/bin/fs-io.d.ts.map +1 -0
- package/dist/bin/fs-io.js +45 -0
- package/dist/bin/fs-io.js.map +1 -0
- package/dist/bin/platform.d.ts +21 -0
- package/dist/bin/platform.d.ts.map +1 -0
- package/dist/bin/platform.js +99 -0
- package/dist/bin/platform.js.map +1 -0
- package/dist/compose/api.d.ts +84 -0
- package/dist/compose/api.d.ts.map +1 -0
- package/dist/compose/api.js +101 -0
- package/dist/compose/api.js.map +1 -0
- package/dist/compose/compose.d.ts +51 -0
- package/dist/compose/compose.d.ts.map +1 -0
- package/dist/compose/compose.js +177 -0
- package/dist/compose/compose.js.map +1 -0
- package/dist/compose/diff.d.ts +7 -0
- package/dist/compose/diff.d.ts.map +1 -0
- package/dist/compose/diff.js +68 -0
- package/dist/compose/diff.js.map +1 -0
- package/dist/compose/errors.d.ts +31 -0
- package/dist/compose/errors.d.ts.map +1 -0
- package/dist/compose/errors.js +35 -0
- package/dist/compose/errors.js.map +1 -0
- package/dist/compose/index.d.ts +3 -0
- package/dist/compose/index.d.ts.map +1 -0
- package/dist/compose/index.js +11 -0
- package/dist/compose/index.js.map +1 -0
- package/dist/compose/parse.d.ts +65 -0
- package/dist/compose/parse.d.ts.map +1 -0
- package/dist/compose/parse.js +122 -0
- package/dist/compose/parse.js.map +1 -0
- package/dist/drift/app-objects.d.ts +107 -0
- package/dist/drift/app-objects.d.ts.map +1 -0
- package/dist/drift/app-objects.js +193 -0
- package/dist/drift/app-objects.js.map +1 -0
- package/dist/drift/db-conformance.d.ts +52 -0
- package/dist/drift/db-conformance.d.ts.map +1 -0
- package/dist/drift/db-conformance.js +89 -0
- package/dist/drift/db-conformance.js.map +1 -0
- package/dist/drift/index.d.ts +8 -0
- package/dist/drift/index.d.ts.map +1 -0
- package/dist/drift/index.js +43 -0
- package/dist/drift/index.js.map +1 -0
- package/dist/drift/raw-sql-indexes.d.ts +106 -0
- package/dist/drift/raw-sql-indexes.d.ts.map +1 -0
- package/dist/drift/raw-sql-indexes.js +113 -0
- package/dist/drift/raw-sql-indexes.js.map +1 -0
- package/dist/drift/raw-sql-tripwire.d.ts +191 -0
- package/dist/drift/raw-sql-tripwire.d.ts.map +1 -0
- package/dist/drift/raw-sql-tripwire.js +422 -0
- package/dist/drift/raw-sql-tripwire.js.map +1 -0
- package/dist/drift/rls-policies.d.ts +226 -0
- package/dist/drift/rls-policies.d.ts.map +1 -0
- package/dist/drift/rls-policies.js +317 -0
- package/dist/drift/rls-policies.js.map +1 -0
- package/dist/drift/run.d.ts +152 -0
- package/dist/drift/run.d.ts.map +1 -0
- package/dist/drift/run.js +252 -0
- package/dist/drift/run.js.map +1 -0
- package/dist/drift/sql-expression.d.ts +27 -0
- package/dist/drift/sql-expression.d.ts.map +1 -0
- package/dist/drift/sql-expression.js +64 -0
- package/dist/drift/sql-expression.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/lock/hash.d.ts +13 -0
- package/dist/lock/hash.d.ts.map +1 -0
- package/dist/lock/hash.js +19 -0
- package/dist/lock/hash.js.map +1 -0
- package/dist/lock/index.d.ts +5 -0
- package/dist/lock/index.d.ts.map +1 -0
- package/dist/lock/index.js +20 -0
- package/dist/lock/index.js.map +1 -0
- package/dist/lock/lock.d.ts +154 -0
- package/dist/lock/lock.d.ts.map +1 -0
- package/dist/lock/lock.js +151 -0
- package/dist/lock/lock.js.map +1 -0
- package/dist/lock/manifest.d.ts +68 -0
- package/dist/lock/manifest.d.ts.map +1 -0
- package/dist/lock/manifest.js +96 -0
- package/dist/lock/manifest.js.map +1 -0
- package/dist/lock/semver.d.ts +10 -0
- package/dist/lock/semver.d.ts.map +1 -0
- package/dist/lock/semver.js +13 -0
- package/dist/lock/semver.js.map +1 -0
- package/dist/seed/index.d.ts +5 -0
- package/dist/seed/index.d.ts.map +1 -0
- package/dist/seed/index.js +16 -0
- package/dist/seed/index.js.map +1 -0
- package/dist/seed/input.d.ts +52 -0
- package/dist/seed/input.d.ts.map +1 -0
- package/dist/seed/input.js +77 -0
- package/dist/seed/input.js.map +1 -0
- package/dist/seed/seed-platform.d.ts +41 -0
- package/dist/seed/seed-platform.d.ts.map +1 -0
- package/dist/seed/seed-platform.js +165 -0
- package/dist/seed/seed-platform.js.map +1 -0
- package/dist/seed/steps.d.ts +172 -0
- package/dist/seed/steps.d.ts.map +1 -0
- package/dist/seed/steps.js +136 -0
- package/dist/seed/steps.js.map +1 -0
- package/dist/seed/types.d.ts +287 -0
- package/dist/seed/types.d.ts.map +1 -0
- package/dist/seed/types.js +5 -0
- package/dist/seed/types.js.map +1 -0
- package/dist/sync/app-migrations.d.ts +52 -0
- package/dist/sync/app-migrations.d.ts.map +1 -0
- package/dist/sync/app-migrations.js +62 -0
- package/dist/sync/app-migrations.js.map +1 -0
- package/dist/sync/apply.d.ts +29 -0
- package/dist/sync/apply.d.ts.map +1 -0
- package/dist/sync/apply.js +38 -0
- package/dist/sync/apply.js.map +1 -0
- package/dist/sync/check.d.ts +59 -0
- package/dist/sync/check.d.ts.map +1 -0
- package/dist/sync/check.js +115 -0
- package/dist/sync/check.js.map +1 -0
- package/dist/sync/errors.d.ts +32 -0
- package/dist/sync/errors.d.ts.map +1 -0
- package/dist/sync/errors.js +23 -0
- package/dist/sync/errors.js.map +1 -0
- package/dist/sync/index.d.ts +10 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +27 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/ledger.d.ts +65 -0
- package/dist/sync/ledger.d.ts.map +1 -0
- package/dist/sync/ledger.js +49 -0
- package/dist/sync/ledger.js.map +1 -0
- package/dist/sync/plan.d.ts +63 -0
- package/dist/sync/plan.d.ts.map +1 -0
- package/dist/sync/plan.js +86 -0
- package/dist/sync/plan.js.map +1 -0
- package/dist/sync/promote.d.ts +62 -0
- package/dist/sync/promote.d.ts.map +1 -0
- package/dist/sync/promote.js +95 -0
- package/dist/sync/promote.js.map +1 -0
- package/dist/sync/timestamps.d.ts +41 -0
- package/dist/sync/timestamps.d.ts.map +1 -0
- package/dist/sync/timestamps.js +68 -0
- package/dist/sync/timestamps.js.map +1 -0
- package/dist/sync/version.d.ts +28 -0
- package/dist/sync/version.d.ts.map +1 -0
- package/dist/sync/version.js +66 -0
- package/dist/sync/version.js.map +1 -0
- package/migrations/0001_initial/migration.sql +297 -0
- package/migrations/0002_add_personal_access_tokens/migration.sql +31 -0
- package/migrations/0003_add_credentials/migration.sql +20 -0
- package/migrations/0004_add_notification_deliveries/migration.sql +27 -0
- package/migrations/0005_drop_stale_uuid_defaults/migration.sql +35 -0
- package/migrations/0006_add_notifications/migration.sql +22 -0
- package/migrations/0007_add_push_subscriptions/migration.sql +25 -0
- package/migrations/0008_add_jobs/migration.sql +110 -0
- package/migrations/0009_add_worker_nodes/migration.sql +90 -0
- package/migrations/0010_add_database_backup_runs/migration.sql +104 -0
- package/migrations/0011_add_notification_broadcasts/migration.sql +57 -0
- package/migrations/0012_add_backup_run_job_link/migration.sql +87 -0
- package/migrations/0013_add_job_node_secrets/migration.sql +61 -0
- package/migrations/0014_add_backup_run_pg_dump_version/migration.sql +26 -0
- package/migrations/0015_add_job_claim_token/migration.sql +92 -0
- package/migrations/0016_add_ai_platform/migration.sql +108 -0
- package/migrations/0017_revoke_viewer_ai_use/migration.sql +32 -0
- package/migrations/0018_add_user_credentials/migration.sql +29 -0
- package/migrations/0019_add_device_session_credential_link/migration.sql +52 -0
- package/migrations/0020_add_worker_node_vitals/migration.sql +3 -0
- package/migrations/0021_add_job_trace_context/migration.sql +6 -0
- package/migrations/0022_add_retention_created_at_indexes/migration.sql +13 -0
- package/migrations/0023_add_organizations/migration.sql +142 -0
- package/migrations/0024_split_system_org_roles/migration.sql +131 -0
- package/migrations/0025_org_scoped_rls/migration.sql +215 -0
- package/migrations/0026_add_groups/migration.sql +165 -0
- package/migrations/0027_add_grants/migration.sql +117 -0
- package/migrations/0028_add_org_settings/migration.sql +49 -0
- package/migrations/0029_add_org_credentials/migration.sql +54 -0
- package/migrations/0030_add_jobs_org_id/migration.sql +18 -0
- package/migrations/0031_add_jobs_org_id_status_index/migration.sql +6 -0
- package/migrations/0032_add_broadcast_target_org/migration.sql +21 -0
- package/migrations/0033_add_android_app/migration.sql +60 -0
- package/migrations/0034_open_job_reason/migration.sql +16 -0
- package/migrations/0035_ai_usage_feature/migration.sql +37 -0
- package/migrations/0036_add_app_metadata/migration.sql +49 -0
- package/migrations/0037_open_sharing_vocabularies/migration.sql +97 -0
- package/migrations/manifest.json +379 -0
- package/package.json +78 -4
- package/raw-sql-indexes.json +94 -0
- package/rls-policies.json +74 -0
- package/schema/ai.prisma +444 -0
- package/schema/android-app.prisma +47 -0
- package/schema/base.prisma +11 -0
- package/schema/credentials.prisma +170 -0
- package/schema/db-backup.prisma +376 -0
- package/schema/identity.prisma +439 -0
- package/schema/jobs.prisma +760 -0
- package/schema/notifications.prisma +649 -0
- package/schema/settings.prisma +60 -0
- package/schema/sharing.prisma +223 -0
- package/schema/storage.prisma +84 -0
package/package.json
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marinoscar/platform-db",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-next.11",
|
|
4
|
+
"description": "Prisma schema fragments, SQL migrations and seed functions of the platform (CommonJS).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=24"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/marinoscar/EnterpriseAppBase.git",
|
|
13
|
+
"directory": "packages/platform-db"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"bin": {
|
|
21
|
+
"platform": "./bin/platform.js"
|
|
22
|
+
},
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./seed": {
|
|
29
|
+
"types": "./dist/seed/index.d.ts",
|
|
30
|
+
"default": "./dist/seed/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"bin",
|
|
37
|
+
"schema",
|
|
38
|
+
"migrations",
|
|
39
|
+
"raw-sql-indexes.json",
|
|
40
|
+
"rls-policies.json",
|
|
41
|
+
"README.md",
|
|
42
|
+
"CHANGELOG.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"prebuild": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
47
|
+
"prepack": "node ../../scripts/copy-license.mjs",
|
|
48
|
+
"build": "tsc -p tsconfig.build.json",
|
|
49
|
+
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
50
|
+
"typecheck": "tsc --noEmit",
|
|
51
|
+
"docs": "typedoc --options typedoc.json",
|
|
52
|
+
"test": "vitest",
|
|
53
|
+
"test:run": "vitest run"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"commander": "^14.0.2"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"prisma": "^7.8.0",
|
|
60
|
+
"zod": "^4.4.3",
|
|
61
|
+
"pg": "^8.23.0"
|
|
62
|
+
},
|
|
63
|
+
"peerDependenciesMeta": {
|
|
64
|
+
"pg": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"prisma": {
|
|
68
|
+
"optional": true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@prisma/client": "^7.8.0",
|
|
73
|
+
"@types/node": "^22.15.32",
|
|
74
|
+
"prisma": "^7.8.0",
|
|
75
|
+
"typescript": "^6.0.3",
|
|
76
|
+
"vitest": "^4.1.8",
|
|
77
|
+
"zod": "^4.4.3",
|
|
78
|
+
"pg": "^8.23.0"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"indexes": [
|
|
3
|
+
{
|
|
4
|
+
"name": "jobs_active_dedup_uniq_idx",
|
|
5
|
+
"table": "jobs",
|
|
6
|
+
"unique": true,
|
|
7
|
+
"definition": "CREATE UNIQUE INDEX jobs_active_dedup_uniq_idx ON public.jobs USING btree (dedup_key) WHERE ((status = ANY (ARRAY['pending'::\"JobStatus\", 'running'::\"JobStatus\"])) AND (dedup_key IS NOT NULL))",
|
|
8
|
+
"reason": "At most one pending or running job per dedup_key; a partial unique index Prisma cannot express (the queue relies on it instead of a find-then-insert).",
|
|
9
|
+
"doc": "docs/specs/job-queue.md",
|
|
10
|
+
"createdIn": "0008_add_jobs"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "jobs_attempts_gt1_idx",
|
|
14
|
+
"table": "jobs",
|
|
15
|
+
"unique": false,
|
|
16
|
+
"definition": "CREATE INDEX jobs_attempts_gt1_idx ON public.jobs USING btree (attempts) WHERE (attempts > 1)",
|
|
17
|
+
"reason": "Partial index over retried jobs (attempts > 1) for the queue insights report; Prisma cannot express a WHERE clause.",
|
|
18
|
+
"doc": "docs/specs/job-queue.md",
|
|
19
|
+
"createdIn": "0008_add_jobs"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "jobs_succeeded_duration_idx",
|
|
23
|
+
"table": "jobs",
|
|
24
|
+
"unique": false,
|
|
25
|
+
"definition": "CREATE INDEX jobs_succeeded_duration_idx ON public.jobs USING btree (finished_at, started_at, type) WHERE ((status = 'succeeded'::\"JobStatus\") AND (started_at IS NOT NULL) AND (finished_at IS NOT NULL))",
|
|
26
|
+
"reason": "Partial index over finished succeeded jobs for the duration percentiles of the queue insights report; Prisma cannot express a WHERE clause.",
|
|
27
|
+
"doc": "docs/specs/job-queue.md",
|
|
28
|
+
"createdIn": "0008_add_jobs"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "database_backup_runs_active_uniq_idx",
|
|
32
|
+
"table": "database_backup_runs",
|
|
33
|
+
"unique": true,
|
|
34
|
+
"definition": "CREATE UNIQUE INDEX database_backup_runs_active_uniq_idx ON public.database_backup_runs USING btree ((true)) WHERE (status = ANY (ARRAY['pending'::\"DatabaseBackupStatus\", 'running'::\"DatabaseBackupStatus\"]))",
|
|
35
|
+
"reason": "At most one pending or running database backup at a time: a constant-expression partial unique index Prisma cannot express.",
|
|
36
|
+
"doc": "docs/specs/database-backup.md",
|
|
37
|
+
"createdIn": "0010_add_database_backup_runs"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "organizations_default_uniq_idx",
|
|
41
|
+
"table": "organizations",
|
|
42
|
+
"unique": true,
|
|
43
|
+
"definition": "CREATE UNIQUE INDEX organizations_default_uniq_idx ON public.organizations USING btree ((true)) WHERE is_default",
|
|
44
|
+
"reason": "Exactly one default organization: a constant-expression partial unique index Prisma cannot express (the default org is a database fact, not a findFirst check).",
|
|
45
|
+
"doc": "docs/specs/platform-packages.md",
|
|
46
|
+
"createdIn": "0023_add_organizations"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "group_invites_pending_uniq_idx",
|
|
50
|
+
"table": "group_invites",
|
|
51
|
+
"unique": true,
|
|
52
|
+
"definition": "CREATE UNIQUE INDEX group_invites_pending_uniq_idx ON public.group_invites USING btree (group_id, email) WHERE ((accepted_at IS NULL) AND (declined_at IS NULL) AND (revoked_at IS NULL))",
|
|
53
|
+
"reason": "At most one PENDING invite per group and address; a declined, revoked or accepted invite does not block re-inviting the address, which a plain @@unique([groupId, email]) would. Prisma cannot express a partial unique index.",
|
|
54
|
+
"doc": "docs/specs/platform-packages.md",
|
|
55
|
+
"createdIn": "0026_add_groups"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "grants_active_user_uniq_idx",
|
|
59
|
+
"table": "grants",
|
|
60
|
+
"unique": true,
|
|
61
|
+
"definition": "CREATE UNIQUE INDEX grants_active_user_uniq_idx ON public.grants USING btree (resource_type, resource_id, grantee_user_id) WHERE ((grantee_kind = 'user'::text) AND (revoked_at IS NULL))",
|
|
62
|
+
"reason": "At most one ACTIVE grant per resource and user (one role per grantee, kvox's rule); a revoked grant does not block a new one. The grants API upserts on it. Prisma cannot express a partial unique index.",
|
|
63
|
+
"doc": "docs/specs/platform-packages.md",
|
|
64
|
+
"createdIn": "0027_add_grants"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "grants_active_group_uniq_idx",
|
|
68
|
+
"table": "grants",
|
|
69
|
+
"unique": true,
|
|
70
|
+
"definition": "CREATE UNIQUE INDEX grants_active_group_uniq_idx ON public.grants USING btree (resource_type, resource_id, grantee_group_id) WHERE ((grantee_kind = 'group'::text) AND (revoked_at IS NULL))",
|
|
71
|
+
"reason": "At most one ACTIVE grant per resource and group; a revoked grant does not block a new one. The grants API upserts on it. Prisma cannot express a partial unique index.",
|
|
72
|
+
"doc": "docs/specs/platform-packages.md",
|
|
73
|
+
"createdIn": "0027_add_grants"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "grants_active_ref_uniq_idx",
|
|
77
|
+
"table": "grants",
|
|
78
|
+
"unique": true,
|
|
79
|
+
"definition": "CREATE UNIQUE INDEX grants_active_ref_uniq_idx ON public.grants USING btree (resource_type, resource_id, grantee_kind, grantee_ref) WHERE ((grantee_kind <> ALL (ARRAY['user'::text, 'group'::text, 'link'::text])) AND (revoked_at IS NULL))",
|
|
80
|
+
"reason": "At most one ACTIVE grant per resource, app-registered grantee kind and reference (one role per grantee, as for users and groups); a revoked grant does not block a new one. The grants API upserts on it. Prisma cannot express a partial unique index.",
|
|
81
|
+
"doc": "docs/specs/platform-packages.md",
|
|
82
|
+
"createdIn": "0037_open_sharing_vocabularies"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "android_app_releases_one_current_uniq_idx",
|
|
86
|
+
"table": "android_app_releases",
|
|
87
|
+
"unique": true,
|
|
88
|
+
"definition": "CREATE UNIQUE INDEX android_app_releases_one_current_uniq_idx ON public.android_app_releases USING btree ((true)) WHERE is_current",
|
|
89
|
+
"reason": "At most one current Android APK release deployment-wide: a constant-expression partial unique index Prisma cannot express. Make-current clears the old flag and sets the new one in one transaction; the index arbitrates concurrent calls (the loser gets 409), never a findFirst pre-check.",
|
|
90
|
+
"doc": "docs/specs/native-companion-architecture.md",
|
|
91
|
+
"createdIn": "0033_add_android_app"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"policies": [
|
|
3
|
+
{
|
|
4
|
+
"name": "storage_objects_org_isolation",
|
|
5
|
+
"table": "storage_objects",
|
|
6
|
+
"reason": "Organization isolation: a row is visible only when org_id equals the transaction-local app.org_id (or the transaction carries app.rls_bypass). Prisma cannot express policies.",
|
|
7
|
+
"doc": "docs/SECURITY-ARCHITECTURE.md",
|
|
8
|
+
"createdIn": "0025_org_scoped_rls"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "storage_object_chunks_org_isolation",
|
|
12
|
+
"table": "storage_object_chunks",
|
|
13
|
+
"reason": "Organization isolation of upload parts; the chunk carries its own org_id because a policy cannot join through its parent.",
|
|
14
|
+
"doc": "docs/SECURITY-ARCHITECTURE.md",
|
|
15
|
+
"createdIn": "0025_org_scoped_rls"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "ai_runs_org_isolation",
|
|
19
|
+
"table": "ai_runs",
|
|
20
|
+
"reason": "Organization isolation of background AI runs, whose request column holds the full prompt.",
|
|
21
|
+
"doc": "docs/SECURITY-ARCHITECTURE.md",
|
|
22
|
+
"createdIn": "0025_org_scoped_rls"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "ai_usage_events_org_isolation",
|
|
26
|
+
"table": "ai_usage_events",
|
|
27
|
+
"reason": "Organization isolation of AI usage accounting; a row with a NULL org_id is visible to the bypass (system) client only.",
|
|
28
|
+
"doc": "docs/SECURITY-ARCHITECTURE.md",
|
|
29
|
+
"createdIn": "0025_org_scoped_rls"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "groups_org_isolation",
|
|
33
|
+
"table": "groups",
|
|
34
|
+
"reason": "Organization isolation of sharing groups (PP-7.1): a group lives inside one organization and is never a tenant.",
|
|
35
|
+
"doc": "docs/SECURITY-ARCHITECTURE.md",
|
|
36
|
+
"createdIn": "0026_add_groups"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "group_members_org_isolation",
|
|
40
|
+
"table": "group_members",
|
|
41
|
+
"reason": "Organization isolation of group memberships; the row carries the group's org_id (composite key to groups) because a policy cannot join through its parent.",
|
|
42
|
+
"doc": "docs/SECURITY-ARCHITECTURE.md",
|
|
43
|
+
"createdIn": "0026_add_groups"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "group_invites_org_isolation",
|
|
47
|
+
"table": "group_invites",
|
|
48
|
+
"reason": "Organization isolation of group invitations, which hold invitee e-mail addresses.",
|
|
49
|
+
"doc": "docs/SECURITY-ARCHITECTURE.md",
|
|
50
|
+
"createdIn": "0026_add_groups"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "grants_org_isolation",
|
|
54
|
+
"table": "grants",
|
|
55
|
+
"reason": "Organization isolation of grants (PP-7.2): a grant shares one record inside its organization and can never name another organization's user or group.",
|
|
56
|
+
"doc": "docs/SECURITY-ARCHITECTURE.md",
|
|
57
|
+
"createdIn": "0027_add_grants"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "org_settings_org_isolation",
|
|
61
|
+
"table": "org_settings",
|
|
62
|
+
"reason": "Organization isolation of an organization's settings overrides (PP-8.1): one row per organization, read and written only inside runInOrg.",
|
|
63
|
+
"doc": "docs/SECURITY-ARCHITECTURE.md",
|
|
64
|
+
"createdIn": "0028_add_org_settings"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "org_credentials_org_isolation",
|
|
68
|
+
"table": "org_credentials",
|
|
69
|
+
"reason": "Organization isolation of organization-owned encrypted credentials (PP-8.8): an org's key is visible only inside that organization's scope.",
|
|
70
|
+
"doc": "docs/SECURITY-ARCHITECTURE.md",
|
|
71
|
+
"createdIn": "0029_add_org_credentials"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|