Sha256: 4bfb4ba54ea2565c127f6765e18b4755b6086732b598abe6dd5823e834d96bd8

Contents?: true

Size: 545 Bytes

Versions: 8

Compression:

Stored size: 545 Bytes

Contents

class MoveDatabaseName < Sequel::Migration
  def up
    [:resources, :resources_versions].each do |name|
      alter_table(name) { add_column(:database_name, String) }
    end

    self[:connections].each do |connection|
      [:resources, :resources_versions].each do |name|
        self[name].filter(:connection_id => connection[:id]).update(:database_name => connection[:database_name])
      end
    end

    alter_table(:connections) { drop_column(:database_name) }
  end

  def down
    raise "This migration is not reversible."
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
coupler-0.0.9-java db/migrate/005_move_database_name.rb
coupler-0.0.8-java db/migrate/005_move_database_name.rb
coupler-0.0.7-java db/migrate/005_move_database_name.rb
coupler-0.0.6-java db/migrate/005_move_database_name.rb
coupler-0.0.4-java db/migrate/005_move_database_name.rb
coupler-0.0.3-java db/migrate/005_move_database_name.rb
coupler-0.0.2-java db/migrate/005_move_database_name.rb
coupler-0.0.1-java db/migrate/005_move_database_name.rb