elasticsearch_record 5.0.1 → 5.0.3
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/docs/CHANGELOG.md +8 -0
- data/lib/active_record/connection_adapters/elasticsearch/schema_definitions/clone_table_definition.rb +0 -0
- data/lib/arel/visitors/elasticsearch_query.rb +19 -2
- data/lib/elasticsearch_record/gem_version.rb +1 -1
- data/lib/elasticsearch_record/tasks/elasticsearch_database_tasks.rb +11 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b18aa777ca6fea844dc752ed8ae1260ddc72636d59a8f5869e6570fc4f9a2c1
|
|
4
|
+
data.tar.gz: 512d03314871a38a3256844e644b53481ec7638baa51214ee43c089a2cc10165
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b65e98fc0cf0c50380b984e6f8713836e433f7d9c8b79de566e900bd0b898e0a58da67d1fe1d8a7bb54ba47107c6be39b96cddb0a7792f4f007a5c96d7465e96
|
|
7
|
+
data.tar.gz: ef0f42e15d0b31befb0bc1eb1a38df21908d2d4302555b8d59f3750360aa556d3f0d4e9ebc2e0d758b25208e0c81628884968b259003a8587c1b40f50aed1603
|
data/docs/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# ElasticsearchRecord - CHANGELOG
|
|
2
2
|
|
|
3
|
+
## [5.0.3] - 2026-10-19
|
|
4
|
+
* [fix] `ElasticsearchRecord::Tasks::ElasticsearchDatabaseTasks#check_current_protected_environment!` - rails 8.1 asks every tasks class for it, so 'db:drop', 'db:purge', 'db:schema:load' & 'db:test:prepare' no longer abort with a `NoMethodError`
|
|
5
|
+
|
|
6
|
+
## [5.0.2] - 2026-09-17
|
|
7
|
+
* [add] `Arel::Visitors::ElasticsearchQuery#visit_Arel_Nodes_Casted` & `#visit_Arel_Nodes_Quoted` - the value nodes `Arel::Attributes::Attribute#eq` & co. build for plain values
|
|
8
|
+
* [add] specs for `SchemaMigration#delete_version` & `#delete_all_versions`
|
|
9
|
+
* [fix] `Arel::Visitors::ElasticsearchQuery#visit_Arel_Nodes_DeleteStatement` compiles a delete on a plain table _(the `ActiveRecord::SchemaMigration#delete_version` shape)_ into a delete-by-query - rolling a migration back removes its version again instead of raising a `NotImplementedError`
|
|
10
|
+
|
|
3
11
|
## [5.0.1] - 2026-09-16
|
|
4
12
|
* [add] specs for `Elasticsearch::Column` identity, deduplication & YAML round-trip
|
|
5
13
|
* [fix] `Elasticsearch::Column#==`, `#eql?` & `#hash` also compare `virtual`, `fields`, `properties`, `meta` & `enabled` - same-named columns of different indexes no longer share a single deduplicated object
|
|
File without changes
|
|
@@ -63,9 +63,16 @@ module Arel # :nodoc: all
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
# DELETE (by query - not a single record...)
|
|
66
|
+
#
|
|
67
|
+
# A plain +Arel::Table+ relation is the shape of a +DeleteManager+ built straight on a table -
|
|
68
|
+
# +ActiveRecord::SchemaMigration#delete_version+ does exactly that to remove a rolled back version.
|
|
69
|
+
# Elasticsearch has no "delete by column value" apart from a delete-by-query, and a single record
|
|
70
|
+
# never reaches Arel (see @ ElasticsearchRecord::ModelApi#delete), so the conditions of such a
|
|
71
|
+
# statement are compiled into a delete-by-query on that index - the same as a relation's +delete_all+.
|
|
72
|
+
# Without any condition the statement would wipe the whole index, which is not what a delete means.
|
|
66
73
|
def visit_Arel_Nodes_DeleteStatement(o)
|
|
67
|
-
#
|
|
68
|
-
if o.relation.is_a?(::Arel::Table)
|
|
74
|
+
# a plain table without conditions is neither a single record nor a query
|
|
75
|
+
if o.relation.is_a?(::Arel::Table) && o.wheres.blank?
|
|
69
76
|
raise NotImplementedError, "if you've made it this far, something went wrong ..."
|
|
70
77
|
end
|
|
71
78
|
|
|
@@ -463,6 +470,16 @@ module Arel # :nodoc: all
|
|
|
463
470
|
alias :visit_String :visit_Struct_Raw
|
|
464
471
|
alias :visit_Arel_Nodes_SqlLiteral :visit_Struct_Raw
|
|
465
472
|
|
|
473
|
+
# CASTED / QUOTED values - the nodes +Arel::Attributes::Attribute#eq+ & co. wrap a plain value in
|
|
474
|
+
# (see @ Arel::Nodes.build_quoted). Returns the database value: the attribute of a model table
|
|
475
|
+
# type casts it, the attribute of a plain +Arel::Table+ returns the value unchanged.
|
|
476
|
+
def visit_Arel_Nodes_Casted(o)
|
|
477
|
+
o.value_for_database
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
# alias for QUOTED returns
|
|
481
|
+
alias :visit_Arel_Nodes_Quoted :visit_Arel_Nodes_Casted
|
|
482
|
+
|
|
466
483
|
# used by insert / update statements.
|
|
467
484
|
# does not claim / assign any values!
|
|
468
485
|
# returns a Hash of key => value pairs
|
|
@@ -34,6 +34,17 @@ module ElasticsearchRecord
|
|
|
34
34
|
nil
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
+
# Since rails 8.1 the protected-environment check of 'db:drop', 'db:purge', 'db:schema:load'
|
|
38
|
+
# & co. is asked of the tasks class of every database config
|
|
39
|
+
# (+ActiveRecord::Tasks::DatabaseTasks.check_protected_environments!+) - without this method
|
|
40
|
+
# each of these tasks aborts with a NoMethodError.
|
|
41
|
+
# The cluster never stores an environment (+ElasticsearchRecord::InternalMetadata#enabled?+ is
|
|
42
|
+
# false), so there is nothing to protect or to mismatch - the outcome the central check of
|
|
43
|
+
# rails <= 8.0 had for an elasticsearch config as well.
|
|
44
|
+
def check_current_protected_environment!(*)
|
|
45
|
+
nil
|
|
46
|
+
end
|
|
47
|
+
|
|
37
48
|
private
|
|
38
49
|
|
|
39
50
|
attr_reader :db_config
|