Sha256: b789743befc84670b438fb8fa2b1ac16827d75b03fd7a89946ddb4ff1775b919
Contents?: true
Size: 983 Bytes
Versions: 9
Compression:
Stored size: 983 Bytes
Contents
class AddMessagesToMailinglists < ActiveRecord::Migration class Mailinglist < ActiveRecord::Base; end def self.up add_column :mailinglists, :welcome_admin_message_id, :integer, :default => 1 add_column :mailinglists, :confirmed_admin_message_id, :integer, :default => 2 add_column :mailinglists, :sayonara_admin_message_id, :integer, :default => 3 default_welcome_message = AdminMessage.find 1 default_confirmed_message = AdminMessage.find 2 default_sayonara_message = AdminMessage.find 3 Mailinglist.find_all.each do |m| m.welcome_admin_message_id = 1 m.confirmed_admin_message_id = 2 m.sayonara_admin_message_id = 3 m.save end end def self.down remove_column :mailinglists, :welcome_admin_message_id remove_column :mailinglists, :confirmed_admin_message_id remove_column :mailinglists, :sayonara_admin_message_id end end
Version data entries
9 entries across 9 versions & 1 rubygems