lib/active_replicas/railtie.rb in active_replicas-0.1.7 vs lib/active_replicas/railtie.rb in active_replicas-0.2.0
- old
+ new
@@ -6,33 +6,38 @@
cattr_accessor :primary_delegated_methods
# All the methods which are safe to be delegated to a replica.
@@replica_delegated_methods = (
[
- :active?, :clear_query_cache, :column_name_for_operation, :columns,
+ :active?, :cacheable_query, :case_sensitive_comparison,
+ :case_sensitive_modifier, :case_insensitive_comparison,
+ :clear_query_cache, :column_name_for_operation, :columns,
:disable_query_cache!, :disconnect!, :enable_query_cache!,
- :query_cache_enabled, :quote_column_name, :quote_table_name,
- :raw_connection, :reconnect!, :sanitize_limit, :schema_cache, :select,
- :select_all, :select_one, :select_rows, :select_value, :select_values,
- :substitute_at, :to_sql, :verify!
+ :exec_query, :prepared_statements, :query_cache_enabled, :quote,
+ :quote_column_name, :quote_table_name,
+ :quote_table_name_for_assignment, :raw_connection, :reconnect!,
+ :sanitize_limit, :schema_cache, :select, :select_all, :select_one,
+ :select_rows, :select_value, :select_values, :substitute_at, :to_sql,
+ :type_cast, :valid_type?, :verify!
]
).uniq
# Rails methods that translate to SQL DDL (data definition language).
DDL_METHODS = [
:add_column, :add_foreign_key, :add_index, :add_reference,
:add_timestamps, :change_column, :change_column_default,
- :change_column_null, :create_join_table, :create_table,
- :drop_join_table, :drop_table, :enable_extension, :execute,
- :execute_block, :initialize_schema_migrations_table, :remove_column,
- :remove_columns, :remove_foreign_key, :remove_index, :remove_reference,
- :remove_timestamps, :rename_column, :rename_index, :rename_table
+ :change_column_null, :column_spec, :create_join_table, :create_table,
+ :delete_table, :drop_join_table, :drop_table, :enable_extension,
+ :execute, :execute_block, :initialize_schema_migrations_table,
+ :migration_keys, :remove_column, :remove_columns, :remove_foreign_key,
+ :remove_index, :remove_reference, :remove_timestamps, :rename_column,
+ :rename_index, :rename_table
]
# Rails methods that deal with create, read, update, delete in SQL
CRUD_METHODS = [
- :delete, :insert, :truncate, :update
+ :delete, :insert, :next_sequence_value, :truncate, :update
]
# Rails methods that query whether or not the adapter or database engine
# supports a given feature.
SUPPORTS_METHODS = [
@@ -47,12 +52,15 @@
@@primary_delegated_methods = (
DDL_METHODS +
CRUD_METHODS +
SUPPORTS_METHODS +
[
- :assume_migrated_upto_version, :foreign_keys, :native_database_types,
- :next_sequence_value, :prefetch_primary_key?, :tables,
- :table_exists?, :transaction, :transaction_state
+ :add_transaction_record, :assume_migrated_upto_version,
+ :begin_db_transaction, :commit_db_transaction,
+ :disable_referential_integrity, :foreign_keys, :indexes,
+ :native_database_types, :prefetch_primary_key?, :primary_key,
+ :rollback_db_transaction, :tables, :table_exists?, :transaction,
+ :transaction_state
]
).uniq
def self.hijack_active_record(proxy_configuration, overrides: [])
ProxyingConnection.generate_replica_delegations