Develop#28
Conversation
Expose the canonical systemplane DDL and a universal default seed from the root systemplane package so consumers can fold schema provisioning into their own migration pipelines instead of relying on the lib's runtime runSchema. - Add ddl/schema.sql (byte-faithful to runtime runSchema; table systemplane_entries + systemplane_notify_v3() + INSERT/DELETE and UPDATE triggers on channel systemplane_changes; static, no placeholders). - Add ddl/default_seed.sql (neutral runtime_config baseline, INSERT ... ON CONFLICT (namespace, "key") DO NOTHING). - Embed both via //go:embed and expose SchemaSQL() / DefaultSeedSQL(). - Add unit tests; the schema test asserts the embed contains the canonical fragments the runtime emits (drift-prevention via consistency test). - Update CHANGELOG.
feat(ddl): publish systemplane schema + default seed as importable artifacts
…lts seed lib-systemplane no longer creates its schema or seeds defaults at runtime. The Postgres store and the multi-tenant Manager previously ran CREATE TABLE / CREATE FUNCTION / CREATE TRIGGER plus an INSERT ... ON CONFLICT DO NOTHING defaults seed on first use (Store.Start / OnTenantActivated). Those runtime DDL/seed paths are removed. Consumers now provision systemplane_entries (plus systemplane_notify_v3() and the NOTIFY triggers) and any defaults externally using the published SchemaSQL()/DefaultSeedSQL() (e.g. via their migration pipeline). The runtime database role needs only DML + LISTEN — no CREATE on the schema — which aligns with the least-privilege per-tenant roles the tenant-manager hands back (runtime DDL otherwise fails with permission denied for schema ... (42501)). No current consumers depend on the removed runtime bootstrap, so this is a behavior change with no expected real-world breakage — shipped as a non-breaking minor. Postgres store: - Remove runSchema and its CREATE TABLE/FUNCTION/TRIGGER builders (postgres_schema.go deleted). - Remove ensureSchema / schemaOnce / schemaErr lazy-bootstrap machinery and the Start()/resolveDB() calls into them. Start now only opens LISTEN; resolveDB only resolves the tenant handle. Manager: - OnTenantActivated no longer runs schema creation or the runtime seed; it warm-loads + opens LISTEN only. - Remove runSchemaAndSeed, runSchema, and seedDefaults. - warmLoad tolerates a not-yet-provisioned table (SQLSTATE 42P01): it logs at WARN and proceeds with an empty, non-stale cache instead of failing activation; LISTEN/poll refreshes once the table exists. SchemaSQL()/DefaultSeedSQL() are intact and are now the ONLY way the schema/defaults are expressed. Tests: - Integration tests provision the table via the published DDL in setup instead of relying on runtime auto-create. - Add a least-privilege Postgres integration test (DML-only role, no CREATE) proving Get/Set/Delete succeed with no runtime DDL. - Add a Manager integration test proving activation tolerates a missing table, and a unit test for the 42P01 detection helper. Recommended next version: v1.7.0 (next beta v1.7.0-beta.1). Not tagged here.
…ootstrap feat(schema): provision schema externally; drop runtime DDL and defaults seed
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (21)
WalkthroughThe PR removes schema provisioning from the library's runtime and shifts that responsibility to external consumer migrations. It exposes the DDL and seed SQL as embedded artifacts via ChangesSchema Provisioning Migration
Comment |
🔒 Security Scan Results —
|
| Stage | Status | Blocking? |
|---|---|---|
| Filesystem Scan | ✅ Clean | — |
| Docker Image Scan | ➖ Skipped | — |
| Docker Hub Health Score | ➖ Skipped | — |
| Pre-release Version Check | ✅ Clean | — |
Trivy
Filesystem Scan
✅ No vulnerabilities or secrets found.
Pre-release Version Check
✅ No unstable version pins found.
🔍 PR Validation Summary🚫 PR Blocked — 2 blocking failures
|
📊 Unit Test Coverage Report:
|
| Metric | Value |
|---|---|
| Overall Coverage | 80.4% ✅ PASS |
| Threshold | 80% |
Coverage by Package
| Package | Coverage |
|---|---|
github.com/LerianStudio/lib-systemplane/admin |
88.4% |
github.com/LerianStudio/lib-systemplane/internal/client |
80.7% |
github.com/LerianStudio/lib-systemplane/internal/debounce |
73.1% |
github.com/LerianStudio/lib-systemplane/internal/manager |
87.9% |
github.com/LerianStudio/lib-systemplane/internal/mongodb |
97.5% |
github.com/LerianStudio/lib-systemplane/internal/postgres |
100.0% |
github.com/LerianStudio/lib-systemplane |
94.8% |
Generated by Go PR Analysis workflow
No description provided.