Module: AfterMigrate
- Defined in:
- lib/after_migrate.rb,
lib/after_migrate/store.rb,
lib/after_migrate/railtie.rb,
lib/after_migrate/version.rb,
lib/after_migrate/executor.rb,
lib/after_migrate/collector.rb,
lib/after_migrate/adapters/sql.rb,
lib/after_migrate/adapters/mysql.rb,
lib/after_migrate/adapters/sqlite.rb,
lib/after_migrate/adapters/postgresql.rb
Defined Under Namespace
Modules: Collector, Executor, Mysql, Postgresql, Sql, Sqlite, Stores
Classes: Configuration, Railtie
Constant Summary
collapse
- VERSION =
'0.2.4'
Class Method Summary
collapse
Class Method Details
.affected_tables ⇒ Object
Persistent cross-migration store: schema_name => Concurrent::Set<table_name>
86
87
88
|
# File 'lib/after_migrate.rb', line 86
def affected_tables
store.affected_tables
end
|
.configuration ⇒ Object
73
74
75
|
# File 'lib/after_migrate.rb', line 73
def configuration
@configuration ||= Configuration.new
end
|
77
78
79
|
# File 'lib/after_migrate.rb', line 77
def configure
yield(configuration)
end
|
.log(msg) ⇒ Object
81
82
83
|
# File 'lib/after_migrate.rb', line 81
def log(msg)
warn "[after_migrate] #{msg}" if AfterMigrate.configuration.verbose
end
|
.merge_tables(schema, table_names) ⇒ Object
90
91
92
|
# File 'lib/after_migrate.rb', line 90
def merge_tables(schema, table_names)
store.merge_tables(schema, table_names)
end
|
.reset! ⇒ Object
102
103
104
|
# File 'lib/after_migrate.rb', line 102
def reset!
store.reset!
end
|
.run!(schema: nil) ⇒ Object
Trigger database maintenance on all collected tables, then clear the store. In multi-tenant setups call this once after all tenant migrations complete.
96
97
98
99
100
|
# File 'lib/after_migrate.rb', line 96
def run!(schema: nil)
return unless configuration.enabled
Executor.call(schema:)
end
|
.store ⇒ Object
106
107
108
109
110
|
# File 'lib/after_migrate.rb', line 106
def store
@store = nil if @store_key != store_key
@store_key = store_key
@store ||= build_store
end
|