Sha256: d0f1909061e87f7c639f3ec2cbbf0cdaf274ebc24b7df69fe8f7d1bf4661e850

Contents?: true

Size: 758 Bytes

Versions: 1

Compression:

Stored size: 758 Bytes

Contents

class ActiveRecord::Migration
  module DesertMigration
    def migrate_plugin(plugin_name, version)
      plugin = find_plugin(plugin_name)
      Desert::PluginMigrations::Migrator.migrate_plugin(
        plugin,
        version
      )
    end

    protected
    def find_plugin(plugin_name)
      plugin = Desert::Manager.find_plugin(plugin_name.to_s)
      return plugin if plugin
      raise ArgumentError, "No plugin found named #{plugin_name}"
    end

    def column_exists?(table_name, column_name)
      !ActiveRecord::Base.connection.columns(table_name).detect {|c| c.name == column_name }.nil?
    end
    
    def table_exists?(table_name)
      ActiveRecord::Base.connection.tables.include? table_name
    end
  end
  extend DesertMigration
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
desert-0.5.4 lib/desert/rails/migration.rb