elasticsearch_record 5.0.1 → 5.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cef7d68e9ae9718034159014687d3f5237a473cb63b0ec00d0db8e2db17e4fa6
4
- data.tar.gz: 6de7559f4e5711be72fe942e1fbfdccc6b316e4b958678377173b6e03037b67c
3
+ metadata.gz: c40dcd47630a8b238e2aea55c4a1fd11996618606267fac0aeb8ff1f6675cbae
4
+ data.tar.gz: 6cf4bbabec3588fe3f65b97f10a7fb98cb79d163db044c845cca15d8b467fe35
5
5
  SHA512:
6
- metadata.gz: 8bd4dc770aad866810a674bfb5e91cce295f5659189d73315fe558a9309ffe73c15c7bdeba0b94bcf923058ebcd5d2e33f4652f064a343d4d2cc97a75644c205
7
- data.tar.gz: abff63bee87a65d7ecb7b9ee26a6063ee812d103f3ff5dcbca90f927e45d052ffdf8ab68950ba7667b27a88296504ee1cd6696ba497cb6944c11a32566f494a7
6
+ metadata.gz: a22d8ee32007b72c6893e0f4a31f7b796f8f231665c7b3f56bb693fbf795e7ff014000105f69fb4c5817e97a985d93061c76c26f76dba877b16c4a5a4f635130
7
+ data.tar.gz: 2de3a166ea5f5c9e06b96c923475d31e2683fc5c4c12d6e696a08f1efda7c4f100b2b1deb08f80fef2acb2787e78a4bb12126aa4ae4aabfec02d68d1c05c3dec
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # ElasticsearchRecord - CHANGELOG
2
2
 
3
+ ## [5.0.2] - 2026-09-17
4
+ * [add] `Arel::Visitors::ElasticsearchQuery#visit_Arel_Nodes_Casted` & `#visit_Arel_Nodes_Quoted` - the value nodes `Arel::Attributes::Attribute#eq` & co. build for plain values
5
+ * [add] specs for `SchemaMigration#delete_version` & `#delete_all_versions`
6
+ * [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`
7
+
3
8
  ## [5.0.1] - 2026-09-16
4
9
  * [add] specs for `Elasticsearch::Column` identity, deduplication & YAML round-trip
5
10
  * [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
@@ -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
- # switch between updating a single Record or multiple by query
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
@@ -9,7 +9,7 @@ module ElasticsearchRecord
9
9
  module VERSION
10
10
  MAJOR = 5
11
11
  MINOR = 0
12
- TINY = 1
12
+ TINY = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Gonsior