-require 'migrate'
+require "migrate"
class CreateUserBlocks < ActiveRecord::Migration
- def self.up
+ def change
create_table :user_blocks do |t|
t.column :user_id, :bigint, :null => false
t.column :moderator_id, :bigint, :null => false
t.timestamps
end
- add_foreign_key :user_blocks, [:user_id], :users, [:id]
- add_foreign_key :user_blocks, [:moderator_id], :users, [:id]
- add_foreign_key :user_blocks, [:revoker_id], :users, [:id]
+ add_foreign_key :user_blocks, :users, :name => "user_blocks_user_id_fkey"
+ add_foreign_key :user_blocks, :users, :column => :moderator_id, :name => "user_blocks_moderator_id_fkey"
+ add_foreign_key :user_blocks, :users, :column => :revoker_id, :name => "user_blocks_revoker_id_fkey"
add_index :user_blocks, [:user_id]
end
-
- def self.down
- drop_table :user_blocks
- end
end