Module: YiffSpace::Fixers::RequiresFix

Defined in:
lib/yiffspace/fixers/requires_fix.rb

Overview

Adds requires_fix to ActiveRecord::Migration - the migration-side mirror of YiffSpace::FixTracker.requires_migration! - so a migration can declare that one or more db/fixes/*.rb scripts must already be applied before it runs, e.g.:

class BackfillWidgetType < ActiveRecord::Migration[8.1]
requires_fix(3)

def change
  ...
end
end

Checked whenever the migration actually runs (so plain db:migrate still refuses to run it out of order), and read back ahead of time by YiffSpace::MigrationSync to order fixes:migrate_all correctly. Included into ActiveRecord::Migration by YiffSpace::Fixers::Engine.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: FixRequired

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



25
26
27
28
# File 'lib/yiffspace/fixers/requires_fix.rb', line 25

def self.included(base)
  base.extend(ClassMethods)
  base.prepend(InstanceMethods)
end