mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
8 lines
368 B
Ruby
8 lines
368 B
Ruby
class MoveReadingsToReadMarks < ActiveRecord::Migration[6.0]
|
|
def change
|
|
execute "TRUNCATE read_marks"
|
|
execute "INSERT INTO read_marks (readable_type, readable_id, reader_type, reader_id, timestamp)
|
|
SELECT readable_type, readable_id, 'User', user_id, updated_at
|
|
FROM readings GROUP BY readable_type, readable_id, user_id;"
|
|
end
|
|
end
|