Class: RailsDataMigrations::Migrator
- Inherits:
-
ActiveRecord::Migrator
- Object
- ActiveRecord::Migrator
- RailsDataMigrations::Migrator
- Defined in:
- lib/rails_data_migrations/migrator.rb
Class Method Summary collapse
- .get_all_versions(connection = ActiveRecord::Base.connection) ⇒ Object
- .migrations_path ⇒ Object
- .schema_migrations_table_name ⇒ Object
Instance Method Summary collapse
Class Method Details
.get_all_versions(connection = ActiveRecord::Base.connection) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rails_data_migrations/migrator.rb', line 15 def get_all_versions(connection = ActiveRecord::Base.connection) if connection.data_source_exists?(schema_migrations_table_name) LogEntry.all.map { |x| x.version.to_i }.sort else [] end end |
.migrations_path ⇒ Object
27 28 29 |
# File 'lib/rails_data_migrations/migrator.rb', line 27 def migrations_path 'db/data_migrations' end |
.schema_migrations_table_name ⇒ Object
23 24 25 |
# File 'lib/rails_data_migrations/migrator.rb', line 23 def schema_migrations_table_name LogEntry.table_name end |
Instance Method Details
#record_version_state_after_migrating(version) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/rails_data_migrations/migrator.rb', line 4 def (version) if down? migrated.delete(version) LogEntry.where(version: version.to_s).delete_all else migrated << version LogEntry.create!(version: version.to_s) end end |