You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
499 B

  1. class EncryptedMessageIdsToTimestampIds < ActiveRecord::Migration[5.2]
  2. def up
  3. safety_assured do
  4. execute("ALTER TABLE encrypted_messages ALTER COLUMN id SET DEFAULT timestamp_id('encrypted_messages')")
  5. end
  6. end
  7. def down
  8. execute("LOCK encrypted_messages")
  9. execute("SELECT setval('encrypted_messages_id_seq', (SELECT MAX(id) FROM encrypted_messages))")
  10. execute("ALTER TABLE encrypted_messages ALTER COLUMN id SET DEFAULT nextval('encrypted_messages_id_seq')")
  11. end
  12. end