X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/1a65b3ac6f04dc1936f9007b232ecd4bb442b4e4..2882a65d21fd5758c2a90d1cbd808103ab7b8000:/db/migrate/029_add_user_foreign_keys.rb?ds=sidebyside diff --git a/db/migrate/029_add_user_foreign_keys.rb b/db/migrate/029_add_user_foreign_keys.rb index 759359258..33ba25721 100644 --- a/db/migrate/029_add_user_foreign_keys.rb +++ b/db/migrate/029_add_user_foreign_keys.rb @@ -1,20 +1,14 @@ -require 'lib/migrate' - -class AddUserForeignKeys < ActiveRecord::Migration - def self.up - add_foreign_key :changesets, [:user_id], :users, [:id] - add_foreign_key :diary_comments, [:user_id], :users, [:id] - add_foreign_key :diary_entries, [:user_id], :users, [:id] - add_foreign_key :friends, [:user_id], :users, [:id] - add_foreign_key :friends, [:friend_user_id], :users, [:id] - add_foreign_key :gpx_files, [:user_id], :users, [:id] - add_foreign_key :messages, [:from_user_id], :users, [:id] - add_foreign_key :messages, [:to_user_id], :users, [:id] - add_foreign_key :user_preferences, [:user_id], :users, [:id] - add_foreign_key :user_tokens, [:user_id], :users, [:id] - end - - def self.down - raise ActiveRecord::IrreversibleMigration +class AddUserForeignKeys < ActiveRecord::Migration[4.2] + def change + add_foreign_key :changesets, :users, :name => "changesets_user_id_fkey" + add_foreign_key :diary_comments, :users, :name => "diary_comments_user_id_fkey" + add_foreign_key :diary_entries, :users, :name => "diary_entries_user_id_fkey" + add_foreign_key :friends, :users, :name => "friends_user_id_fkey" + add_foreign_key :friends, :users, :column => :friend_user_id, :name => "friends_friend_user_id_fkey" + add_foreign_key :gpx_files, :users, :name => "gpx_files_user_id_fkey" + add_foreign_key :messages, :users, :column => :from_user_id, :name => "messages_from_user_id_fkey" + add_foreign_key :messages, :users, :column => :to_user_id, :name => "messages_to_user_id_fkey" + add_foreign_key :user_preferences, :users, :name => "user_preferences_user_id_fkey" + add_foreign_key :user_tokens, :users, :name => "user_tokens_user_id_fkey" end end