29 lines
799 B
Ruby
29 lines
799 B
Ruby
# typed: strict
|
|
# frozen_string_literal: true
|
|
|
|
class MigrateDomainUserPostFavsFa < ActiveRecord::Migration[7.2]
|
|
sig { void }
|
|
def change
|
|
up_only { execute <<-SQL }
|
|
INSERT INTO
|
|
domain_user_post_favs_fa (
|
|
user_id,
|
|
post_id,
|
|
fa_fav_id,
|
|
removed,
|
|
explicit_time,
|
|
inferred_time
|
|
)
|
|
SELECT
|
|
user_id,
|
|
post_id,
|
|
(json_attributes->>'fav_id')::integer as fa_fav_id,
|
|
removed,
|
|
to_timestamp((json_attributes->>'explicit_time')::integer) as explicit_time,
|
|
to_timestamp((json_attributes->>'inferred_time')::integer) as inferred_time
|
|
FROM domain_user_post_favs
|
|
WHERE type = 'Domain::UserPostFav::FaUserPostFav'
|
|
SQL
|
|
end
|
|
end
|