Sha256: 04f5b1cba8c64a47c7b4baa6e25be449077c24173675e17087da57008dc7221b
Contents?: true
Size: 926 Bytes
Versions: 3
Compression:
Stored size: 926 Bytes
Contents
# encoding: UTF-8 Sequel.migration do no_transaction up do [:content, :spontaneous_content_archive, :spontaneous_content_history].each do |table| begin alter_table table do add_column :content_hash_changed_at, :timestamp end rescue ::Sequel::DatabaseError => e # because syncing ignores the content_archive table # if we run this migration, then sync, then re-run it # (in the case where the production db is behind the dev db) # this one table will throw an error raise unless table == :spontaneous_content_archive end transaction do self[table].update(content_hash_changed_at: :modified_at) end end end down do [:content, :spontaneous_content_archive, :spontaneous_content_history].each do |table| alter_table table do drop_column :content_hash_changed_at end end end end
Version data entries
3 entries across 3 versions & 1 rubygems