feat: add inline timestamp columns to metaschema-schema tables#80
Merged
Conversation
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 EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
created_at timestamptz DEFAULT now()andupdated_at timestamptz DEFAULT now()inline in the CREATE TABLE statements for all 18metaschema_publictables that have timestamps applied viadb_utils.timestamps()in the internal metaschema package.Why: The export tool (
@pgpmjs/export) uses dynamic GraphQL introspection to discover columns, generates INSERTs includingcreated_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-dbmakesdb_utils.timestamps()idempotent so it gracefully handles pre-existing columns.Link to Devin session: https://app.devin.ai/sessions/c055c0fee37240409898cf34c096a4ac
Requested by: @pyramation