1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/db/migrate/20240221211359_notification_request_ids_to_timestamp_ids.rb

15 lines
554 B
Ruby

# frozen_string_literal: true
class NotificationRequestIdsToTimestampIds < ActiveRecord::Migration[7.1]
def up
safety_assured do
execute("ALTER TABLE notification_requests ALTER COLUMN id SET DEFAULT timestamp_id('notification_requests')")
end
end
def down
execute('LOCK notification_requests')
execute("SELECT setval('notification_requests_id_seq', (SELECT MAX(id) FROM notification_requests))")
execute("ALTER TABLE notification_requests ALTER COLUMN id SET DEFAULT nextval('notification_requests_id_seq')")
end
end