Class: CreateAdminNotes

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/active_admin/install/templates/migrations/1_create_admin_notes.rb

Class Method Summary collapse

Class Method Details

.downObject



13
14
15
# File 'lib/generators/active_admin/install/templates/migrations/1_create_admin_notes.rb', line 13

def self.down
  drop_table :admin_notes
end

.upObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/generators/active_admin/install/templates/migrations/1_create_admin_notes.rb', line 2

def self.up
  create_table :admin_notes do |t|
    t.references :resource, :polymorphic => true, :null => false
    t.references :admin_user, :polymorphic => true
    t.text :body
    t.timestamps
  end
  add_index :admin_notes, [:resource_type, :resource_id]
  add_index :admin_notes, [:admin_user_type, :admin_user_id]
end