3 class CreateUserBlocks < ActiveRecord::Migration[4.2]
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
13 t.timestamps :null => true
16 add_foreign_key :user_blocks, :users, :name => "user_blocks_user_id_fkey"
17 add_foreign_key :user_blocks, :users, :column => :moderator_id, :name => "user_blocks_moderator_id_fkey"
18 add_foreign_key :user_blocks, :users, :column => :revoker_id, :name => "user_blocks_revoker_id_fkey"
20 add_index :user_blocks, [:user_id]