Use more robust hook for loading timestamp_id function into database (#15919)

This commit is contained in:
Claire 2021-03-19 02:43:13 +01:00 committed by GitHub
parent a4dcaef53b
commit 9aaaa96d2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 58 deletions

View file

@ -1,7 +1,7 @@
class StatusIdsToTimestampIds < ActiveRecord::Migration[5.1]
def up
# Prepare the function we will use to generate IDs.
Rake::Task['db:define_timestamp_id'].execute
Mastodon::Snowflake.define_timestamp_id
# Set up the statuses.id column to use our timestamp-based IDs.
ActiveRecord::Base.connection.execute(<<~SQL)
@ -11,7 +11,7 @@ class StatusIdsToTimestampIds < ActiveRecord::Migration[5.1]
SQL
# Make sure we have a sequence to use.
Rake::Task['db:ensure_id_sequences_exist'].execute
Mastodon::Snowflake.ensure_id_sequences_exist
end
def down