Truncate readmarks on migration

This commit is contained in:
Ari Timonen 2020-04-02 03:24:23 +03:00
parent cd7b62a39f
commit 8cac6510da

View file

@ -1,8 +1,8 @@
class MoveReadingsToReadMarks < ActiveRecord::Migration[6.0]
def change
# execute "TRUNCATE read_marks"
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;"
FROM readings GROUP BY readable_type, readable_id, user_id;"
end
end