~cytrogen/masto-fe

ref: 19ebf7797ebb64002c6b5ea8fcf2fcb8bba760bc masto-fe/lib/active_record/database_tasks_extensions.rb -rw-r--r-- 503 bytes
19ebf779 — Claire Merge commit 'e6b903b21e0682c1156ffec583ac2836fda7d657' into glitch-soc/merge-upstream 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require_relative '../mastodon/snowflake'

module ActiveRecord
  module Tasks
    module DatabaseTasks
      original_load_schema = instance_method(:load_schema)

      define_method(:load_schema) do |db_config, *args|
        ActiveRecord::Base.establish_connection(db_config)
        Mastodon::Snowflake.define_timestamp_id

        original_load_schema.bind_call(self, db_config, *args)

        Mastodon::Snowflake.ensure_id_sequences_exist
      end
    end
  end
end