Module: PgTrigger::Generator
- Defined in:
- lib/pg_trigger/generator.rb
Defined Under Namespace
Classes: Migration
Class Method Summary collapse
Class Method Details
.run(models:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pg_trigger/generator.rb', line 9 def run(models:) triggers = models.filter_map { |m| m._triggers.presence }.flatten scanner = Scanner.new(File.read(PgTrigger.structure_file_path)) existing = scanner.triggers plan = Plan::Builder.new(triggers, existing).result return if plan.empty? migration = Migration.new(plan) migration.save_to_file migration.name end |