test: prove module database access with PostgreSQL

Add a real installed-module fixture (core/tests/fixtures/module-database-integration/db-facade)
with its own manifest, Drizzle schema, drizzle-kit-generated migration, and permissioned HTTP
routes, then exercise it end to end in a new apps/api PostgreSQL integration suite: explicit
migration application before the module runtime starts (never auto-created), start/stop/HTTP
handlers sharing one ModuleDatabase facade by reference, authorized read/mutation/transaction
commit and rollback against real PostgreSQL, denied/rejected-origin/OPTIONS/HEAD requests never
reaching the module or its table, and both a module-caught and an uncaught real database failure
sanitizing exactly as pass 1 established. Registered alongside the existing suites in
vitest.migrations.integration.config.ts; no production code, schema, or migration changed.
This commit is contained in:
ekklesia
2026-07-25 21:26:15 -05:00
parent 0e308eb9ad
commit d1b9efd4d2
10 changed files with 1044 additions and 0 deletions
@@ -0,0 +1,4 @@
CREATE TABLE "db_facade_records" (
"id" uuid PRIMARY KEY NOT NULL,
"value" text NOT NULL
);
@@ -0,0 +1,44 @@
{
"id": "8764dbfb-a411-4727-a382-530e4cdf3a2c",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.db_facade_records": {
"name": "db_facade_records",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true
},
"value": {
"name": "value",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
@@ -0,0 +1,12 @@
{
"version": 1,
"moduleId": "db-facade",
"entries": [
{
"tag": "0000_initial",
"destructive": {
"mode": "none"
}
}
]
}
@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1700000000000,
"tag": "0000_initial",
"breakpoints": true
}
]
}