Sha256: 8d9476fc50a2572f64c845113be83850da18fef6840b870cd5b1e9b5fe4f2dfb

Contents?: true

Size: 409 Bytes

Versions: 1

Compression:

Stored size: 409 Bytes

Contents

class RenameDeploysCommitToSha < ActiveRecord::Migration
  def up
    rename_column :deploys, :commit, :sha
    execute <<-SQL
      UPDATE deploys
         SET sha=commits.sha
        FROM commits
       WHERE deploys.commit_id=commits.id
    SQL
    change_column_null :deploys, :sha, false
  end
  
  def down
    change_column_null :deploys, :sha, true
    rename_column :deploys, :sha, :commit
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
houston-core-0.5.0.beta1 db/migrate/20140925021043_rename_deploys_commit_to_sha.rb