ensl.org/db/migrate/20200402000314_move_readings_to_read_marks.rb
2020-04-02 03:16:03 +03:00

8 lines
325 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;"
end
end