Method: Thredded::DbTools.migrate

Defined in:
lib/thredded/db_tools.rb

.migrate(paths:, quiet:, &filter) ⇒ Object

Runs the migrations in the given paths.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/thredded/db_tools.rb', line 9

def migrate(paths:, quiet:, &filter)
  verbose_was = ActiveRecord::Migration.verbose
  ActiveRecord::Migration.verbose = !quiet
  migrate =
    -> { ActiveRecord::MigrationContext.new(paths, ActiveRecord::SchemaMigration).migrate(nil, &filter) }
  if quiet
    silence_active_record(&migrate)
  else
    migrate.call
  end
ensure
  ActiveRecord::Migration.verbose = verbose_was
end