X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/09c5740b5bb94c75a5c8c83cdbb80ae7b5ccbdf4..7b057545c0b2030aad9981bd93699f9e33ad7d5f:/db/migrate/045_create_user_blocks.rb diff --git a/db/migrate/045_create_user_blocks.rb b/db/migrate/045_create_user_blocks.rb index 7276ef1a5..3ccd522f9 100644 --- a/db/migrate/045_create_user_blocks.rb +++ b/db/migrate/045_create_user_blocks.rb @@ -1,7 +1,7 @@ -require 'lib/migrate' +require "migrate" -class CreateUserBlocks < ActiveRecord::Migration - def self.up +class CreateUserBlocks < ActiveRecord::Migration[5.0] + def change create_table :user_blocks do |t| t.column :user_id, :bigint, :null => false t.column :moderator_id, :bigint, :null => false @@ -10,17 +10,13 @@ class CreateUserBlocks < ActiveRecord::Migration t.column :needs_view, :boolean, :null => false, :default => false t.column :revoker_id, :bigint - t.timestamps + t.timestamps :null => true 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