diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2020-06-02 19:24:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-02 19:24:53 +0200 |
commit | 5d8398c8b8b51ee7363e7d45acc560f489783e34 (patch) | |
tree | 1e0b663049feafdc003ad3c01b25bf5d5d793402 /db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb | |
parent | 9b7e3b4774d47c184aa759364d41f40e0cdfa210 (diff) |
Add E2EE API (#13820)
Diffstat (limited to 'db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb')
-rw-r--r-- | db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb b/db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb new file mode 100644 index 000000000..24d43a0bf --- /dev/null +++ b/db/migrate/20200521180606_encrypted_message_ids_to_timestamp_ids.rb @@ -0,0 +1,13 @@ +class EncryptedMessageIdsToTimestampIds < ActiveRecord::Migration[5.2] + def up + safety_assured do + execute("ALTER TABLE encrypted_messages ALTER COLUMN id SET DEFAULT timestamp_id('encrypted_messages')") + end + end + + def down + execute("LOCK encrypted_messages") + execute("SELECT setval('encrypted_messages_id_seq', (SELECT MAX(id) FROM encrypted_messages))") + execute("ALTER TABLE encrypted_messages ALTER COLUMN id SET DEFAULT nextval('encrypted_messages_id_seq')") + end +end |