scinote-web/db/migrate/20150716064453_create_activities.rb

19 lines
533 B
Ruby
Raw Normal View History

2017-06-30 16:23:28 +08:00
class CreateActivities < ActiveRecord::Migration[4.2]
2016-02-12 23:52:43 +08:00
def change
create_table :activities do |t|
t.integer :my_module_id, null: false
t.integer :user_id
t.integer :type_of, null: false
t.string :message, null: false
t.timestamps null: false
end
add_foreign_key :activities, :my_modules
add_foreign_key :activities, :users
add_index :activities, :my_module_id
add_index :activities, :user_id
add_index :activities, :type_of
add_index :activities, :created_at
end
end