tina4ruby 3.13.60 → 3.13.61
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/lib/tina4/orm.rb +23 -0
- data/lib/tina4/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: 5a1fe8987a4b278ffa81f920f3a04af6747b306c06d991543f9cc9813d4c4fd9
|
|
4
|
+
data.tar.gz: fbc9186a54212acd053e83ba9980faf482b65e4831c7ef912d9717c741d662f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 29bc302b4ed44939105eaad0181fe863ed655b4bc28a3271fce8964943d61c4240f5f12a8ff2d9da221588445d5e4ff7071eaebac52f3bb632e4c3d9051b7d64
|
|
7
|
+
data.tar.gz: 5911bf0ffa529102fa933ae7841b64cef1b6bbe02bd6b9a693ea2db8bce4bd290f986291b0f3313e7eb42a6f5b20f1d44552cf642a12b7d65c30de6500e71bd1
|
data/lib/tina4/orm.rb
CHANGED
|
@@ -766,6 +766,29 @@ module Tina4
|
|
|
766
766
|
# back to the exception text) on @last_error + @errors so it survives,
|
|
767
767
|
# and log it with model/table context. ──
|
|
768
768
|
cause = (self.class.db.get_error rescue nil) || e.message
|
|
769
|
+
# ── DX hint (parity with the Python master's save(), v3.13.60): turn a
|
|
770
|
+
# bare driver error into an actionable fix for the two commonest ORM
|
|
771
|
+
# write footguns. Match case-insensitively (SQLite: "no such table" /
|
|
772
|
+
# "no such column: is_deleted" / "has no column named is_deleted";
|
|
773
|
+
# Postgres/MySQL: "does not exist" / "doesn't exist" / "unknown
|
|
774
|
+
# column"). Any OTHER error keeps its raw cause untouched so an
|
|
775
|
+
# unrelated failure (NOT NULL, duplicate PK) is never masked. ──
|
|
776
|
+
low = cause.to_s.downcase
|
|
777
|
+
sd_field = self.class.soft_delete_field.to_s
|
|
778
|
+
if self.class.soft_delete && low.include?(sd_field) && (
|
|
779
|
+
low.include?("no such column") || low.include?("has no column") ||
|
|
780
|
+
low.include?("does not exist") || low.include?("doesn't exist") ||
|
|
781
|
+
low.include?("unknown column")
|
|
782
|
+
)
|
|
783
|
+
cause += " — soft_delete is on but the '#{sd_field}' column is missing; " \
|
|
784
|
+
"declare it (integer_field :#{sd_field}, default: 0) or add a migration"
|
|
785
|
+
elsif low.include?("no such table") || (
|
|
786
|
+
(low.include?("does not exist") || low.include?("doesn't exist")) &&
|
|
787
|
+
!low.include?("column")
|
|
788
|
+
)
|
|
789
|
+
cause += " — table '#{self.class.table_name}' does not exist; " \
|
|
790
|
+
"call #{self.class.name}.create_table or run a migration"
|
|
791
|
+
end
|
|
769
792
|
@last_error = cause
|
|
770
793
|
@errors = [cause]
|
|
771
794
|
Tina4::Log.error(
|
data/lib/tina4/version.rb
CHANGED