27 lines
549 B
Ruby
27 lines
549 B
Ruby
# frozen_string_literal: true
|
|
|
|
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
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|