tina4ruby 3.13.9 → 3.13.11
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 +25 -3
- data/lib/tina4/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a23c9445f57fd1c84a7bed4e5325a26f94f2234d703f889ffea769faefa5622e
|
|
4
|
+
data.tar.gz: 7082c808b1d72968997c69167b734cea292e2616c086b46b05831254f30f0353
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9896ecf33201656f977ceb7bdf4739f2585b14ec32e2c969f61b5ae3c24d69b007ce02d79b053dd96be680af7a5eed8bac8f262fab43e0fc1c51720ff3b2cae
|
|
7
|
+
data.tar.gz: 9722548ba9dcc819407c20d426154eab388f092424e2d1a9bcd253a877bf79579e5937ee98d319adf2f736aceee0ce57e24c939755a38db070109df9bca76819
|
data/lib/tina4/orm.rb
CHANGED
|
@@ -302,13 +302,27 @@ module Tina4
|
|
|
302
302
|
def create_table
|
|
303
303
|
return true if db.table_exists?(table_name)
|
|
304
304
|
|
|
305
|
+
# v3.13.11 (BooleanField parity): pick each engine's native
|
|
306
|
+
# bool type where it's reliable. SQLite has no native bool;
|
|
307
|
+
# Firebird's driver round-trip for native BOOLEAN is uneven —
|
|
308
|
+
# both stay on INTEGER. PG/MySQL/MSSQL use their native types
|
|
309
|
+
# so Python ``True``/Ruby ``true`` bind cleanly without
|
|
310
|
+
# ``operator does not exist: boolean = integer`` errors.
|
|
311
|
+
engine = (db.respond_to?(:get_database_type) ? db.get_database_type : "").to_s.downcase
|
|
312
|
+
bool_sql = case engine
|
|
313
|
+
when "postgres", "postgresql" then "BOOLEAN"
|
|
314
|
+
when "mysql" then "BOOLEAN" # alias for TINYINT(1)
|
|
315
|
+
when "mssql", "sqlserver" then "BIT"
|
|
316
|
+
else "INTEGER" # sqlite, firebird, odbc, anything else
|
|
317
|
+
end
|
|
318
|
+
|
|
305
319
|
type_map = {
|
|
306
320
|
integer: "INTEGER",
|
|
307
321
|
string: "VARCHAR(255)",
|
|
308
322
|
text: "TEXT",
|
|
309
323
|
float: "REAL",
|
|
310
324
|
decimal: "REAL",
|
|
311
|
-
boolean:
|
|
325
|
+
boolean: bool_sql,
|
|
312
326
|
date: "DATE",
|
|
313
327
|
datetime: "DATETIME",
|
|
314
328
|
timestamp: "TIMESTAMP",
|
|
@@ -419,10 +433,18 @@ module Tina4
|
|
|
419
433
|
setter = "#{key}="
|
|
420
434
|
__send__(setter, value) if respond_to?(setter)
|
|
421
435
|
end
|
|
422
|
-
# Set defaults
|
|
436
|
+
# Set defaults.
|
|
437
|
+
# v3.13.11 (issue #50.1): when the default is a Proc/lambda
|
|
438
|
+
# (``default: -> { Time.now }``), call it per-instance so
|
|
439
|
+
# per-row timestamps actually differ. Class objects are
|
|
440
|
+
# excluded — ``default: Integer`` is almost never intended
|
|
441
|
+
# to mean ``Integer.new`` (and Integer has no zero-arg
|
|
442
|
+
# constructor anyway).
|
|
423
443
|
self.class.field_definitions.each do |name, opts|
|
|
424
444
|
if __send__(name).nil? && opts[:default]
|
|
425
|
-
|
|
445
|
+
d = opts[:default]
|
|
446
|
+
d = d.call if d.respond_to?(:call) && !d.is_a?(Class)
|
|
447
|
+
__send__("#{name}=", d)
|
|
426
448
|
end
|
|
427
449
|
end
|
|
428
450
|
end
|
data/lib/tina4/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tina4ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.13.
|
|
4
|
+
version: 3.13.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tina4 Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|