Skip to content

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Jan 14, 2026

Summary

Upstreams schema changes from constructive-db to the public pgpm-modules repository. This includes new module tables, a unified object_category enum type, and categorization columns across metaschema tables.

metaschema-modules package:

  • Add 4 new tables: table_module, user_profiles_module, user_settings_module, organization_settings_module
  • Add node_type column and index to field_module

metaschema-schema package:

  • Add unified object_category enum type ('core', 'module', 'app') replacing inline table_category and field_category types
  • Add categorization columns (category, module, scope, tags, smart_tags) to: policy, schema, table, field, procedure, trigger, index, and all constraint tables
  • Rename templatepolicy_type in policy table
  • Add is_public column to schema table

Updates since last revision

  • Updated test snapshots in metaschema-modules to include the 4 new module tables and updated constraint counts
  • Fixed field table revert script: removed DROP TYPE metaschema_public.field_category since the field table now uses the shared object_category type instead of an inline type
  • Removed default_is_approved and default_is_verified columns from memberships_module in favor of secure-by-default approach

Review & Testing Checklist for Human

  • Breaking change: templatepolicy_type: The policy table column rename is a breaking change for existing code referencing template. Verify this aligns with constructive-db.
  • Verify pgpm.plan dependency ordering: The object_category type must deploy before all tables that reference it. Check that the plan file correctly orders migrations.
  • Test fresh deployment: These are CREATE TABLE statements, not migrations. Deploy to a fresh database to verify the schema creates correctly.
  • Verify no implementation details leaked: Per user request, confirm no node_type_registry references or specific node type names (FieldSlug, DataDirectOwner, etc.) appear in the public repo.

Recommended test plan: Deploy the metaschema-schema and metaschema-modules packages to a fresh PostgreSQL database and verify all tables create successfully with correct foreign key relationships.

Notes

This is part of a coordinated 3-repo update:

  • pgpm-modules (this PR)
  • constructive-db (PR #337)
  • constructive (PR #607)

Requested by: Dan Lynch (@pyramation)

Link to Devin run: https://app.devin.ai/sessions/7ae0a5a06e9f4cbea02826b895676582

metaschema-modules package:
- Add table_module table for table-level modules with node_type pattern
- Add user_profiles_module table for user profiles configuration
- Add user_settings_module table for user settings configuration
- Add organization_settings_module table for organization settings configuration
- Update field_module to add node_type column and index
- Update memberships_module to add default_is_approved and default_is_verified columns

metaschema-schema package:
- Add object_category enum type ('core', 'module', 'app') for unified categorization
- Update policy table: rename template to policy_type, add smart_tags, category, module, scope, tags
- Update schema table: add smart_tags, category, module, scope, tags, is_public
- Update table: use object_category instead of inline table_category type
- Update field: use object_category instead of inline field_category type
- Update procedure, trigger, index tables: add categorization columns
- Update check_constraint, foreign_key_constraint, primary_key_constraint, unique_constraint: add categorization columns
- Update pgpm.plan with object_category type and dependencies
@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

Updated snapshots to include the 4 new module tables:
- table_module
- user_profiles_module
- user_settings_module
- organization_settings_module

Also updated constraint counts to reflect the new foreign key relationships.
The field table now uses the shared object_category type instead of the
inline field_category type, so the revert script should not try to drop
field_category.
…hips_module

These columns are being removed in favor of a secure-by-default approach.
@pyramation pyramation merged commit 7cae484 into main Jan 14, 2026
22 checks passed
@pyramation pyramation deleted the devin/1768350899-upstream-metaschema-changes branch January 14, 2026 01:28
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.

2 participants