20240221211359_notification_request_ids_to_timestamp_ids.rb 554 B

123456789101112131415
  1. # frozen_string_literal: true
  2. class NotificationRequestIdsToTimestampIds < ActiveRecord::Migration[7.1]
  3. def up
  4. safety_assured do
  5. execute("ALTER TABLE notification_requests ALTER COLUMN id SET DEFAULT timestamp_id('notification_requests')")
  6. end
  7. end
  8. def down
  9. execute('LOCK notification_requests')
  10. execute("SELECT setval('notification_requests_id_seq', (SELECT MAX(id) FROM notification_requests))")
  11. execute("ALTER TABLE notification_requests ALTER COLUMN id SET DEFAULT nextval('notification_requests_id_seq')")
  12. end
  13. end