1 class CreateUserBlocks < ActiveRecord::Migration[4.2]
3 create_table :user_blocks do |t|
4 t.column :user_id, :bigint, :null => false
5 t.column :moderator_id, :bigint, :null => false
6 t.column :reason, :text, :null => false
7 t.column :end_at, :datetime, :null => false
8 t.column :needs_view, :boolean, :null => false, :default => false
9 t.column :revoker_id, :bigint
11 t.timestamps :null => true
14 add_foreign_key :user_blocks, :users, :name => "user_blocks_user_id_fkey"
15 add_foreign_key :user_blocks, :users, :column => :moderator_id, :name => "user_blocks_moderator_id_fkey"
16 add_foreign_key :user_blocks, :users, :column => :revoker_id, :name => "user_blocks_revoker_id_fkey"
18 add_index :user_blocks, [:user_id]