Class: Radiant::ExtensionMigrator
- Defined in:
- lib/radiant/extension_migrator.rb
Class Attribute Summary collapse
-
.extension ⇒ Object
Returns the value of attribute extension.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(direction, migrations_path, target_version = nil) ⇒ ExtensionMigrator
constructor
A new instance of ExtensionMigrator.
Constructor Details
#initialize(direction, migrations_path, target_version = nil) ⇒ ExtensionMigrator
Returns a new instance of ExtensionMigrator.
23 24 25 26 |
# File 'lib/radiant/extension_migrator.rb', line 23 def initialize(direction, migrations_path, target_version = nil) super initialize_extension_schema_migrations end |
Class Attribute Details
.extension ⇒ Object
Returns the value of attribute extension.
4 5 6 |
# File 'lib/radiant/extension_migrator.rb', line 4 def extension @extension end |
Class Method Details
.get_all_versions ⇒ Object
16 17 18 19 20 |
# File 'lib/radiant/extension_migrator.rb', line 16 def get_all_versions ActiveRecord::Base.connection.select_values("SELECT version FROM #{schema_migrations_table_name}"). select { |version| version.starts_with?("#{@extension.extension_name}-")}. map { |version| version.sub("#{@extension.extension_name}-", '').to_i }.sort end |
.migrate(target_version = nil) ⇒ Object
6 7 8 |
# File 'lib/radiant/extension_migrator.rb', line 6 def migrate(target_version = nil) super extension.migrations_path, target_version end |
.migrate_extensions ⇒ Object
10 11 12 13 14 |
# File 'lib/radiant/extension_migrator.rb', line 10 def migrate_extensions Extension.descendants.each do |ext| ext.migrator.migrate end end |