From: Matt Amos Date: Mon, 3 Aug 2009 13:58:10 +0000 (+0000) Subject: Added foreign keys to some oauth tables. X-Git-Tag: live~6798^2~16 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/6e146bfba9b6fa6df3733fc1fec46cb842e61652?hp=05e212027339733cf39aa9b7536c3f5f69ba0962 Added foreign keys to some oauth tables. --- diff --git a/db/migrate/040_add_foreign_keys_to_oauth_tables.rb b/db/migrate/040_add_foreign_keys_to_oauth_tables.rb new file mode 100644 index 000000000..09de54349 --- /dev/null +++ b/db/migrate/040_add_foreign_keys_to_oauth_tables.rb @@ -0,0 +1,15 @@ +require 'lib/migrate' + +class AddForeignKeysToOauthTables < ActiveRecord::Migration + def self.up + add_foreign_key :oauth_tokens, [:user_id], :users, [:id] + add_foreign_key :oauth_tokens, [:client_application_id], :client_applications, [:id] + add_foreign_key :client_applications, [:user_id], :users, [:id] + end + + def self.down + remove_foreign_key :oauth_tokens, [:user_id], :users + remove_foreign_key :oauth_tokens, [:client_application_id], :client_applications + remove_foreign_key :client_applications, [:user_id], :users + end +end