X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e660e609661edadc1ed5ad49d6e83e936b2f91cd..4bca24a7beb4a78cecfeaa775d41662497f9930f:/db/migrate/029_add_user_foreign_keys.rb diff --git a/db/migrate/029_add_user_foreign_keys.rb b/db/migrate/029_add_user_foreign_keys.rb index cb0d9e1dd..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 '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