Module: Ridgepole::ExtTidb::Install

Defined in:
lib/ridgepole/ext_tidb/install.rb

Class Method Summary collapse

Class Method Details

.apply_activerecord_patchesObject



22
23
24
25
26
27
28
# File 'lib/ridgepole/ext_tidb/install.rb', line 22

def self.apply_activerecord_patches
  extend_connection_adapters
  # SchemaDumper への直接パッチは不要(dump は DumpPatch が担当)
  # TableDefinition 拡張も不要(Hash#assert_valid_keys 拡張で回避)
  install_connection_hook
  extend_ridgepole_client
end

.apply_patches!Object

Ridgepole起動時にTiDB検出→各パッチをprepend



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ridgepole/ext_tidb/install.rb', line 7

def self.apply_patches!
  # Hash#assert_valid_keysを拡張してauto_randomキーを許可
  extend_hash_assert_valid_keys

  # ActiveRecordが読み込まれている場合は即座に適用
  if defined?(ActiveRecord::Base)
    apply_activerecord_patches
  else
    # ActiveRecordが後でロードされる場合に備えてフックを設定
    ActiveSupport.on_load(:active_record) do
      apply_activerecord_patches
    end
  end
end