2
3
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/generators/has_messages/templates/002_create_message_recipients.rb', line 2
def self.up
create_table :message_recipients do |t|
t.references :message, :null => false
t.references :receiver, :polymorphic => true, :null => false
t.string :kind, :null => false, :length => 20
t.integer :position
t.string :state, :null => false, :length => 10
t.datetime :hidden_at
end
add_index :message_recipients, [:receiver_type, :receiver_id]
add_index :message_recipients, [:message_id, :kind, :position], :unique => true
end
|