Skip to content

Reuse temporal column metadata - #423

Merged
tagliala merged 1 commit into
masterfrom
issue-422-reuse-temporal-columns
Sep 7, 2026
Merged

tagliala merged 1 commit into
masterfrom
issue-422-reuse-temporal-columns

Conversation

@tagliala

@tagliala tagliala commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Reuse the existing columns(table) result in chrono_public_view_ddl
  • Rename the local quoted column list to quoted_columns to avoid shadowing columns
  • Preserve existing behavior while avoiding a duplicate metadata query

Verification

  • bundle exec rubocop lib/chrono_model/adapter/ddl.rb
  • bundle exec rspec spec/chrono_model/adapter/ddl_spec.rb (11 examples, 0 failures)
  • bundle exec rspec spec/chrono_model (489 examples, 0 failures)
  • git diff --check

Closes #422

@tagliala
tagliala force-pushed the issue-422-reuse-temporal-columns branch 3 times, most recently from 7db5233 to a03ba42 Compare September 7, 2026 09:00
@tagliala
tagliala requested a balanced review from Copilot September 7, 2026 09:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is a small, behavior-preserving refactor that removes a duplicate metadata query and the method shadowing without altering the generated DDL or trigger arguments.

Pull request overview

This PR is a small, behavior-preserving refactor of chrono_public_view_ddl in the ChronoModel PostgreSQL adapter. It removes a duplicated columns(table) metadata lookup and eliminates a local variable that shadowed the inherited columns method (which had forced the use of self.columns(table)). It resolves issue #422.

Changes:

  • Cache the result of columns(table) in a table_columns local and reuse it for both the default-value loop and the quoted-column list.
  • Rename the quoted column list local from columns to quoted_columns, removing the method shadowing and the self. prefix.
  • Pass quoted_columns through to chrono_create_UPDATE_trigger, preserving the previously passed value.
File summaries
File Description
lib/chrono_model/adapter/ddl.rb Reuses cached column metadata and renames the quoted-column local to remove method shadowing, with no behavioral change.

Notes: The linked issue's example snippet used columns(current), but the PR keeps columns(table) to match the original behavior (both prior calls used table), which is the correct choice to preserve behavior. The value passed to chrono_create_UPDATE_trigger is unchanged (an array of quoted column names with the primary key removed), so the trigger's journaling logic behaves identically.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Reuse the existing columns(table) result when building the public
view and its triggers. Rename the local quoted column list to avoid
shadowing the columns method while preserving behavior.

Closes #422
@tagliala
tagliala force-pushed the issue-422-reuse-temporal-columns branch from a03ba42 to 57ba01a Compare September 7, 2026 10:07
@tagliala
tagliala merged commit 348ab38 into master Sep 7, 2026
27 of 31 checks passed
@tagliala
tagliala deleted the issue-422-reuse-temporal-columns branch September 7, 2026 10: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.

Extract columns in chrono_public_view_ddl to avoid duplication and method shadowing

2 participants