Skip to content

chore: sync metaschema-schema from constructive-db#44

Merged
pyramation merged 2 commits intomainfrom
devin/1772324287-sync-metaschema-schema
Mar 1, 2026
Merged

chore: sync metaschema-schema from constructive-db#44
pyramation merged 2 commits intomainfrom
devin/1772324287-sync-metaschema-schema

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Mar 1, 2026

chore: sync metaschema-schema from constructive-db

Summary

Bulk sync of packages/metaschema-schema from the canonical copy in constructive-io/constructive-db/pgpm-modules/metaschema-schema. This repo had fallen significantly behind. Key changes:

Dead table removal:

  • Deleted procedure, limit_function, and rls_function tables (deploy, revert, verify, combined SQL, pgpm.plan)

New table:

  • Added default_privilege for declarative ALTER DEFAULT PRIVILEGES (grant/revoke on tables, functions, sequences)

Column renames (breaking):

  • role_namegrantee_name in policy, table_grant, view_grant
  • templatepolicy_type in policy

New columns:

  • is_grant boolean on table_grant and view_grant (enables revoke records)
  • smart_tags, category, module, scope, tags added to index, trigger, check_constraint, foreign_key_constraint, primary_key_constraint, unique_constraint, field

Other schema changes:

  • database table: removed schema_name and private_schema_name columns
  • table unique constraint widened to (database_id, schema_id, name) (was (database_id, name))
  • field.category type changed from field_category to object_category; field_category enum removed
  • object_category enum now includes module and app values
  • databases_table_unique_name_idx now includes schema_id

Updates since last revision

  • Updated test snapshots for metaschema-modules and services packages to reflect schema changes:
    • services.test.ts.snap: removed schema_name and private_schema_name from database snapshot (columns were dropped)
    • modules.test.ts.snap: updated constraint counts (72600→67416, 102535→96840) due to dead table removal; re-sorted sessions_module snapshot block (content unchanged, just ordering)
  • CI now fully green (22/22 checks passing)

Review & Testing Checklist for Human

  • Verify rls_function deletion is intentional — the conversation only explicitly mentioned procedure and limit_function as dead code. Confirm rls_function is also dead in constructive-db (it appears to have been removed there previously, but worth double-checking).
  • Verify column renames don't break downstream consumersrole_namegrantee_name and templatepolicy_type are breaking changes. Check that no other packages in this repo or downstream consumers reference the old column names.
  • Verify field_category type removal — confirm no downstream code in pgpm-modules or consumers references metaschema_public.field_category directly.
  • Verify combined SQL (metaschema-schema--0.15.5.sql) is consistent with the individual deploy files — this was synced as a whole file from constructive-db, not regenerated locally.
  • Spot-check snapshot constraint count changes — the constraint counts dropped significantly (e.g. 72600→67416). This is expected from dead table removal, but worth a sanity check that no live tables were accidentally removed.

Notes

Syncs all changes from constructive-db/pgpm-modules/metaschema-schema:
- Add default_privilege table (new)
- Add is_grant to table_grant and view_grant
- Rename role_name to grantee_name across grant/policy tables
- Remove dead procedure, limit_function, and rls_function tables
- Update combined SQL and pgpm.plan
- Various field/table updates (smart_tags, module, scope columns)
@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 3f9731d into main Mar 1, 2026
22 checks passed
@pyramation pyramation deleted the devin/1772324287-sync-metaschema-schema branch March 1, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant