Sha256: 627514fb787fc3dd9ba9f27df2737c3452dfb880e087898fa2282bf247dd824c

Contents?: true

Size: 739 Bytes

Versions: 4

Compression:

Stored size: 739 Bytes

Contents

# This migration comes from alchemy (originally 20160617224938)
class ChangeAlchemyPagesLockedToLockedAt < ActiveRecord::Migration
  def up
    add_column :alchemy_pages, :locked_at, :datetime
    update <<-SQL.strip_heredoc
      UPDATE alchemy_pages
      SET locked_at = updated_at
      WHERE locked=#{ActiveRecord::Base.connection.quoted_true}
    SQL
    remove_column :alchemy_pages, :locked
    add_index :alchemy_pages, [:locked_at, :locked_by]
  end

  def down
    add_column :alchemy_pages, :locked, :boolean
    update <<-SQL.strip_heredoc
      UPDATE alchemy_pages
      SET locked=#{ActiveRecord::Base.connection.quoted_true}
      WHERE locked_at IS NOT NULL
    SQL
    remove_column :alchemy_pages, :locked_at
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alchemy-devise-3.6.0 spec/dummy/db/migrate/20160627081901_change_alchemy_pages_locked_to_locked_at.alchemy.rb
alchemy-devise-3.5.0 spec/dummy/db/migrate/20160627081901_change_alchemy_pages_locked_to_locked_at.alchemy.rb
alchemy-devise-3.5.0.beta spec/dummy/db/migrate/20160627081901_change_alchemy_pages_locked_to_locked_at.alchemy.rb
alchemy-devise-3.4.0 spec/dummy/db/migrate/20160627081901_change_alchemy_pages_locked_to_locked_at.alchemy.rb