Skip to content

ReversibleMigration cop for rails 6 multiple databases #463

Closed
@uxxman

Description

@uxxman

Cop doesn't detect violations for rails 6+ multi database project where there are different 'migrations_paths' for each database. It only works for violations for the main database with migrations residing in the 'migrate' folder.


Expected behavior

Cop should detect violations for all database migrations

Actual behavior

Only detect violations for database migrations inside 'migrate' folder and discards all other migrations.

Steps to reproduce the problem

Database.yml from the guides example for rails multi databases. Any migration inside 'db/animals_migrate' doesn't get reported for violations.

production:
  primary:
    database: my_primary_database
    user: root
    adapter: mysql
  primary_replica:
    database: my_primary_database
    user: root_readonly
    adapter: mysql
    replica: true
  animals:
    database: my_animals_database
    user: animals_root
    adapter: mysql
    migrations_paths: db/animals_migrate
  animals_replica:
    database: my_animals_database
    user: animals_readonly
    adapter: mysql
    replica: true

RuboCop version

1.13.0 (using Parser 3.0.1.0, rubocop-ast 1.4.1, running on ruby 3.0.1 x86_64-darwin20)

  • rubocop-performance 1.11.0
  • rubocop-rails 2.9.1
  • rubocop-rspec 2.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions