Reuse temporal column metadata - #423
Conversation
7db5233 to
a03ba42
Compare
There was a problem hiding this comment.
🟢 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 atable_columnslocal and reuse it for both the default-value loop and the quoted-column list. - Rename the quoted column list local from
columnstoquoted_columns, removing the method shadowing and theself.prefix. - Pass
quoted_columnsthrough tochrono_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
a03ba42 to
57ba01a
Compare
Summary
columns(table)result inchrono_public_view_ddlquoted_columnsto avoid shadowingcolumnsVerification
bundle exec rubocop lib/chrono_model/adapter/ddl.rbbundle 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 --checkCloses #422