Forked from
PortalMEC / portalmec
1000 commits behind the upstream repository.
-
Mateus Rambo Strey authoredMateus Rambo Strey authored
20160125124508_create_complaints.rb 544 B
class CreateComplaints < ActiveRecord::Migration[4.2]
def change
create_table :complaints do |t|
t.text :description
t.references :user
t.references :complaintable, polymorphic: true, index: true
t.references :complaint_reason
t.timestamps null: false
end
add_foreign_key :complaints, :complaint_reasons, on_delete: :cascade
add_foreign_key :complaints, :users
add_index :complaints, [:user_id, :complaintable_id, :complaintable_type], unique: true, name: 'user_and_complaintable'
end
end