positioning 0.4.9 → 0.4.10
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/CHANGELOG.md +8 -0
- data/lib/positioning/mechanisms.rb +7 -4
- data/lib/positioning/version.rb +1 -1
- 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: ecb51b68f80bde257ed294934fd122a1fabff3acb3438767253afb614664d318
|
|
4
|
+
data.tar.gz: c688039c633220e0afb1b640375fed1dffaf312cd5e418eaa62fb4c5b60b0779
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c588024c1fb254446fd782d03c04c57363bf49cb85911ecee07d525797b31a40b7f0b7389f71a372dcd23e084f234dfdb4d613242e5f88dc3ba382abf882f028
|
|
7
|
+
data.tar.gz: 640dd4e8e75db84a9053e54f57066ea4ab5f80216b84e5754b953851056f9409d0dc979f3d6a7038245e05b35b0f1e390153e5567aab6fe9f4a10fbde964e475
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.4.10] - 2026-11-09
|
|
4
|
+
|
|
5
|
+
- Fix MySQL deadlocks when adding a record to the end of a list while another transaction holds the list's first row and then waits on the scope lock, such as a `touch: true` chain from a child. When nothing needs to move, we no longer run the query that locked that row.
|
|
6
|
+
|
|
3
7
|
## [0.4.9] - 2026-11-06
|
|
4
8
|
|
|
5
9
|
- Fix the healer not locking scopes without a `belongs_to` association (or with a nil one).
|
|
@@ -10,6 +14,10 @@
|
|
|
10
14
|
- Fix healing raising a unique index violation with a custom order, or with existing zero or negative positions. Tied positions are now healed in primary key order.
|
|
11
15
|
- Fix lists being corrupted when a record with a NULL position (or whose row is already gone) is updated or destroyed.
|
|
12
16
|
|
|
17
|
+
## [0.4.8] - 2026-03-28
|
|
18
|
+
|
|
19
|
+
- Fix `belongs_to` scopes with a composite foreign key, both when positioning records and when they're destroyed through their scope's parent.
|
|
20
|
+
|
|
13
21
|
## [0.4.7] - 2025-08-09
|
|
14
22
|
|
|
15
23
|
- Fix `solidify_position` so that it properly raises an error for an invalid string position.
|
|
@@ -114,14 +114,17 @@ module Positioning
|
|
|
114
114
|
record_scope.update_all @column => 0
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
+
# Skip the second query if nothing moved, as MySQL would still lock the scope's first row to find no matches
|
|
117
118
|
def expand(scope, range)
|
|
118
|
-
scope.where(@column => range).update_all
|
|
119
|
-
|
|
119
|
+
if scope.where(@column => range).update_all("#{quoted_column} = #{quoted_column} * -1").positive?
|
|
120
|
+
scope.where(@column => ..-1).update_all "#{quoted_column} = #{quoted_column} * -1 + 1"
|
|
121
|
+
end
|
|
120
122
|
end
|
|
121
123
|
|
|
122
124
|
def contract(scope, range)
|
|
123
|
-
scope.where(@column => range).update_all
|
|
124
|
-
|
|
125
|
+
if scope.where(@column => range).update_all("#{quoted_column} = #{quoted_column} * -1").positive?
|
|
126
|
+
scope.where(@column => ..-1).update_all "#{quoted_column} = #{quoted_column} * -1 - 1"
|
|
127
|
+
end
|
|
125
128
|
end
|
|
126
129
|
|
|
127
130
|
def solidify_position
|
data/lib/positioning/version.rb
CHANGED