Skip to content

feat: add inline timestamp columns to metaschema-schema tables#80

Merged
pyramation merged 2 commits into
mainfrom
feat/metaschema-inline-timestamps
Jun 5, 2026
Merged

feat: add inline timestamp columns to metaschema-schema tables#80
pyramation merged 2 commits into
mainfrom
feat/metaschema-inline-timestamps

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

Summary

Adds created_at timestamptz DEFAULT now() and updated_at timestamptz DEFAULT now() inline in the CREATE TABLE statements for all 18 metaschema_public tables that have timestamps applied via db_utils.timestamps() in the internal metaschema package.

Why: The export tool (@pgpmjs/export) uses dynamic GraphQL introspection to discover columns, generates INSERTs including created_at/updated_at (which exist on the live DB), then deploys against this published schema which lacked them → failure. Adding the columns directly to the table definitions makes the published schema self-documenting and eliminates the drift.

Tables modified: database, schema, table, field, trigger_function, trigger, unique_constraint, table_grant, schema_grant, policy, primary_key_constraint, index, full_text_search, foreign_key_constraint, check_constraint, embedding_chunks, spatial_relation, partition.

Companion PR in constructive-io/constructive-db makes db_utils.timestamps() idempotent so it gracefully handles pre-existing columns.

Link to Devin session: https://app.devin.ai/sessions/c055c0fee37240409898cf34c096a4ac
Requested by: @pyramation

Add created_at/updated_at columns directly in CREATE TABLE statements
for all 18 metaschema_public tables that have timestamps applied via
db_utils.timestamps() in the internal metaschema package.

This fixes schema drift where the published module lacked timestamp
columns that exist on the live database, causing the export tool's
dynamic GraphQL introspection to generate INSERTs with columns that
don't exist on databases deployed from this module.
@devin-ai-integration
Copy link
Copy Markdown

🤖 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, CI, and merge conflict monitoring

@pyramation pyramation merged commit 0b340d2 into main Jun 5, 2026
24 checks passed
@pyramation pyramation deleted the feat/metaschema-inline-timestamps branch June 5, 2026 23:08
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