feat: composite primary keys - #45
Merged
Merged
Conversation
rails_lens:annotate[Foo] only applied the filter to the ActiveRecord source; external sources (e.g. ActiveCypher graph models) ignored it and annotated everything on every run. The rake task also suppressed zero-count source lines and annotate_source swallowed source errors unless verbose, so a filter that matched nothing (like the misread rails_lens:annotate[models]) reported only the graph source line and looked like AR annotation silently skipped models. - filter_models_by_names enforces options[:models] centrally for every source, matching class name or table name - always print per-source counts, including zeros - warn with usage hint when a models filter matches nothing - record source-level errors in results[:failed] instead of dropping them
Use model.primary_key (an Array for composite keys since Rails 7.1) in the CompositeKeys analyzer instead of the legacy primary_keys reader and a raw pg_index query. Schema adapters switch from connection.primary_key (returns nil for composite keys) to connection.primary_keys so composite columns are marked pk = true. Dummy model annotations regenerated accordingly.
…ilience - determine_keys handles Array primary/foreign keys so composite PK columns get PK/FK markers - group_by_database option writes one erd_<db>.mmd per connection; generate_erd command reports every generated file - extracted renderable? guard: a model whose connection is down is skipped instead of aborting the whole diagram
…harness - route/mailer annotators skip writing when file content is unchanged (new annotation_idempotence_test covers schema/route/mailer) - ErrorReporter read RailsLens.verbose/debug/raise_on_error which do not exist on the module; go through RailsLens.config - expose RailsLens.config_file for the loaded config path - Rakefile runs each test file in its own process: `ruby a.rb b.rb` only executes the first file, so most of the suite never ran - fix stale test assertions (TOML sections, NoteCodes, mermaid relationship lines) and un-skip the multi-database annotation test
The old Rakefile only executed the first test file, so the full suite had never run on CI. Running it everywhere surfaced Rails 7.2 incompatibilities (ActiveRecord::ConnectionNotDefined, activerecord- postgis, PostGIS schema DSL); drop 7.2 instead of shimming around it. - gemspec: activerecord/railties >= 8.0.0 - CI matrix: 8.0, 8.1, edge (rails/rails main, future 8.2, non-blocking); Gemfile supports RAILS_VERSION=edge - CI: db:schema:load instead of no-op db:migrate — there are no migration files and only Rails >= 8.1 test_help loads the per-database schema dumps implicitly - ERD: an entity that fails to be added no longer crashes relationship generation; relationships only reference entities present in the diagram - ColumnTypeFormatter falls back to sql_type/'unknown' when column.type is nil (unresolvable custom types) - eager-reference lazy-loaded models in the abstract-class test so .descendants is populated regardless of test order BREAKING CHANGE: Rails 7.2 is no longer supported; require Rails 8.0+.
seuros
force-pushed
the
fix/composite-primary-keys
branch
from
August 10, 2026 23:34
dcca312 to
b660f88
Compare
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.
No description provided.