ensl.org/db/migrate/20200402000314_move_readings_to_read_marks.rb
Ari Timonen 6bcfffa1ee Major update, bugfixes
- Use ruby 2.7.7 as it fixed startup issues
- Update gems
- Remove depr. from puma startup
- Make entry.sh dir-agnostic

Fix tests:
- Use apparition
- Update migrations to use new syntax
- Some other minor changes
2023-02-19 17:08:46 +02:00

8 lines
373 B
Ruby

class MoveReadingsToReadMarks < ActiveRecord::Migration[4.2][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