active_replicas 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/gemfiles/rails_4.gemfile.lock +1 -1
- data/lib/active_replicas/railtie.rb +13 -1
- data/lib/active_replicas/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7caa90c319bc8e2e3f1c4d2e279759e5da28d9b
|
4
|
+
data.tar.gz: 8cf3ca24021943f556315f35e6bb1ccdb543de6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7731ce4d1783326d548601f6b21cf0867eed51b4ca64cf5d91c730aa8ddfa38f476a845b05c8b1f061c18c8b8c2675affe04316daf9f30a6a5c5134273080ce
|
7
|
+
data.tar.gz: 4afcf0738eedadcf8be6fc8df0ddd68b281524a2387b1e884f98e90bc225096eb45c5e8133029dbf20a0bbb642dde79603b51e67c88fe9c636bc68eca887191c
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'active_support/core_ext/class/attribute_accessors'
|
2
|
+
|
1
3
|
module ActiveReplicas
|
2
4
|
class Railtie < Rails::Railtie
|
3
5
|
cattr_reader :connection_handler
|
@@ -5,8 +7,18 @@ module ActiveReplicas
|
|
5
7
|
cattr_accessor :replica_delegated_methods
|
6
8
|
cattr_accessor :primary_delegated_methods
|
7
9
|
|
10
|
+
# Reports what the database can handle, see URL for more information:
|
11
|
+
# https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb
|
12
|
+
DATABASE_LIMITS_METHODS = [
|
13
|
+
:allowed_index_name_length, :column_name_length,
|
14
|
+
:columns_per_multicolumn_index, :columns_per_table, :in_clause_length,
|
15
|
+
:index_name_length, :indexes_per_table, :joins_per_query,
|
16
|
+
:sql_query_length, :table_alias_length, :table_name_length
|
17
|
+
]
|
18
|
+
|
8
19
|
# All the methods which are safe to be delegated to a replica.
|
9
20
|
@@replica_delegated_methods = (
|
21
|
+
DATABASE_LIMITS_METHODS +
|
10
22
|
[
|
11
23
|
:active?, :cacheable_query, :case_sensitive_comparison,
|
12
24
|
:case_sensitive_modifier, :case_insensitive_comparison,
|
@@ -17,7 +29,7 @@ module ActiveReplicas
|
|
17
29
|
:quote_table_name_for_assignment, :raw_connection, :reconnect!,
|
18
30
|
:sanitize_limit, :schema_cache, :select, :select_all, :select_one,
|
19
31
|
:select_rows, :select_value, :select_values, :substitute_at, :to_sql,
|
20
|
-
:type_cast, :valid_type?, :verify!
|
32
|
+
:type_cast, :uncached, :valid_type?, :verify!
|
21
33
|
]
|
22
34
|
).uniq
|
23
35
|
|