Sha256: 37eba21c8adfdcba3d31f20bc2c438e590d8bbc4621adfad278ef885b75bd9bf
Contents?: true
Size: 476 Bytes
Versions: 3
Compression:
Stored size: 476 Bytes
Contents
# typed: ignore class AddOpenedAtToMessages < ActiveRecord::Migration[4.2] class MigrationMessage < ActiveRecord::Base self.table_name = :<%= table_name %> end def self.up add_column :<%= table_name %>, :opened_at, :datetime MigrationMessage.where(opened: true).update_all(opened_at: DateTime.now) end def self.down MigrationMessage.where('opened_at is not null').update_all(opened: true) remove_column :<%= table_name %>, :opened_at end end
Version data entries
3 entries across 3 versions & 1 rubygems