Added new migration code, from Justin
| 3 | 44 | |
|---|---|---|
| 1 | 1 | class <%= class_name %> < ActiveRecord::Migration |
| 2 | 2 | def self.up |
| 3 | 3 | 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 | |
| 13 | 11 | end |
| 14 | 12 | end |
| 15 | 13 | |
| 16 | 14 | def self.down |
| 17 | 15 | drop_table :activity_logs |
| 18 | 16 | end |
| 19 | end | |
| 17 | end | |
