Sha256: 8d293dfc7230f358b4be0284d2353d96278abd77ceedc36a85acf35d4a4977fb
Contents?: true
Size: 661 Bytes
Versions: 15
Compression:
Stored size: 661 Bytes
Contents
class MigratePeopleCommentsToEvents < ActiveRecord::Migration[5.0] class Event < ::Dorsale::ApplicationRecord self.table_name = :dorsale_customer_vault_events belongs_to :comment, class_name: Dorsale::Comment end def change add_column :dorsale_customer_vault_events, :title, :string add_column :dorsale_customer_vault_events, :date, :date Event.where(action: "comment").each do |event| event.title = event.comment.title event.text = event.comment.text event.date = event.comment.date event.save! event.comment.destroy! end remove_column :dorsale_customer_vault_events, :comment_id end end
Version data entries
15 entries across 15 versions & 1 rubygems