3 class CreateUserBlocks < ActiveRecord::Migration
 
   5     create_table :user_blocks do |t|
 
   6       t.column :user_id,      :bigint,   :null => false
 
   7       t.column :moderator_id, :bigint,   :null => false
 
   8       t.column :reason,       :text,     :null => false
 
   9       t.column :end_at,       :datetime, :null => false
 
  10       t.column :needs_view,   :boolean,  :null => false, :default => false
 
  11       t.column :revoker_id,   :bigint
 
  16     add_foreign_key :user_blocks, [:user_id], :users, [:id]
 
  17     add_foreign_key :user_blocks, [:moderator_id], :users, [:id]
 
  18     add_foreign_key :user_blocks, [:revoker_id], :users, [:id]
 
  20     add_index :user_blocks, [:user_id]
 
  24     drop_table :user_blocks