Class: CreateNotifs

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/user_notif/install_templates/create_notifs.rb

Instance Method Summary collapse

Instance Method Details

#changeObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/generators/user_notif/install_templates/create_notifs.rb', line 2

def change
  create_table :notifs do |t|
    # Target is the object of the notification (like a Project, Donation or User)
    t.references :target, polymorphic: true, index: true, null: false
    t.boolean :sticky, default: false
    t.belongs_to :user, index: true
    t.boolean :unread, index: true, default: true
    t.string :type
    t.timestamps
  end
end