discourse-steam-login/db/migrate/20190510055357_migrate_stea...

23 lines
485 B
Ruby
Raw Permalink Normal View History

2019-07-29 21:31:07 -04:00
# frozen_string_literal: true
2019-05-10 03:48:41 -04:00
class MigrateSteamAuthData < ActiveRecord::Migration[5.2]
def up
execute <<~SQL
INSERT INTO user_associated_accounts (
provider_name,
provider_uid,
user_id,
created_at,
updated_at
) SELECT
'steam',
replace(key, 'steam_uid_', ''),
(value::json->>'user_id')::integer,
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
FROM plugin_store_rows
WHERE plugin_name = 'steam'
SQL
end
end