avatar

44

Added new migration code, from Justin

by abloke, 08 Feb, 2008 12:46 PM
3 44  
11 class <%= class_name %> < ActiveRecord::Migration
22   def self.up
33     create_table :activity_logs, :options => "DEFAULT CHARSET = utf8" do |t|
4       t.column :user_id, :integer
5       t.column :activity_loggable_type, :string
6       t.column :activity_loggable_id, :integer
7       t.column :action, :string
8       t.column :created_at, :datetime
9       t.column :culprit_id, :integer
10       t.column :culprit_type, :string
11       t.column :referenced_id, :integer
12       t.column :referenced_type, :string
4       # Thanks to 'Justin' for an updated migration script, much cleaner!
5       t.belongs_to :user 
6       t.string :action 
7       t.references :activity, :null => false, :polymorphic => true 
8       t.references :culprit, :null => false, :polymorphic => true 
9       t.references :referenced, :null => false, :polymorphic => true 
10       t.timestamps 
1311     end
1412   end
1513 
1614   def self.down
1715     drop_table :activity_logs
1816   end
19 end
17 end