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:
parent
5ae9f35e81
commit
ce839a5d5c
|
@ -15,6 +15,8 @@ class MoveToManagedAuthenticator < ActiveRecord::Migration[5.2]
|
||||||
CURRENT_TIMESTAMP
|
CURRENT_TIMESTAMP
|
||||||
FROM plugin_store_rows
|
FROM plugin_store_rows
|
||||||
WHERE plugin_name = 'oauth2_basic'
|
WHERE plugin_name = 'oauth2_basic'
|
||||||
|
ON CONFLICT (provider_name, user_id)
|
||||||
|
DO NOTHING
|
||||||
SQL
|
SQL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue