FIX: Ignore duplicate user_ids when migrating old data

The old storage mechanism had no unique index on the user_id, so it is possible to have bad data. In this case, take the first value, and ignore the rest.
This commit is contained in:
David Taylor 2019-07-27 16:50:54 +01:00
parent 5ae9f35e81
commit ce839a5d5c
1 changed files with 2 additions and 0 deletions

View File

@ -15,6 +15,8 @@ class MoveToManagedAuthenticator < ActiveRecord::Migration[5.2]
CURRENT_TIMESTAMP
FROM plugin_store_rows
WHERE plugin_name = 'oauth2_basic'
ON CONFLICT (provider_name, user_id)
DO NOTHING
SQL
end
end