20150721132025_create_notification_table.rb 560 Bytes
class CreateNotificationTable < ActiveRecord::Migration
  def up
    create_table :notifications do |t|
      t.text :message
      t.integer :environment_id
      t.string :type
      t.boolean :active
      t.column :created_at,                :datetime
      t.column :updated_at,                :datetime
    end

    create_table :notifications_users, id: false do |t|
      t.belongs_to :notification, index: true
      t.belongs_to :user, index: true
    end
  end

  def down
    drop_table :notifications
    drop_table :notifications_users
  end
end