Skip to content

Compute Migration Number Using Rails' Internals #3

@swiknaba

Description

@swiknaba

https://github.com/dbl-works/checker/blob/main/lib/generators/dbl_checker/install_generator.rb#L11

replace hack

migration_version = `bundle exec rails g migration CreateDblChecks`[/db\/migrate\/(\d+)_/, 1]

with

ActiveRecord::Migration.next_migration_number(Kernel.rand(0..99))

see: https://apidock.com/rails/v6.1.3.1/ActiveRecord/Migration/next_migration_number

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions