schema_ferry 0.1.1 → 0.1.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a34cb64f18cd33a93ebbc3636bd1e76e170279d98ec5d9c59b8ef14e8f141fd9
|
|
4
|
+
data.tar.gz: f3ae1fbea45f7b7f5c4d5c79e5704fcc680955a77a9123a73975618c32752b8f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9fa8d644af36d128f1922258299fc96ba682a068f1195fced8e8446e64067c63e5d5ee81b3541f07e162d0e2588495946e111ca5076da608ab9054491f9a8cdd
|
|
7
|
+
data.tar.gz: 18dd78144c3e9ccbba232da685b0248eb22be16a73ac55090edfe6638a7d93d8ef794bcf1babad248a95f324b9bf8a3e4bac4e3db19a2b4d735d09dd45a9cffe
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.2] - 2026-07-06
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- `map_type :datetime, to: :timestamptz` no longer produces a schema that never converges: ActiveRecord's PostgreSQL adapter silently ignores a `precision:` option on `:timestamptz` columns (unlike `:datetime`/`:timestamp`/`:time`, where it's honored), so declaring one caused `apply!` to re-run `change_column` on every single run. `precision` is no longer emitted for `:timestamptz` columns.
|
|
15
|
+
- `BIGINT UNSIGNED` columns with a default value (e.g. `DEFAULT 0`) no longer cause `apply!` to re-run `change_column` on every run after the initial `apply!`. The default is now converted to match the string form ActiveRecord's schema dumper uses for decimal defaults, so it matches ridgepole's exported state instead of diffing against it forever.
|
|
16
|
+
|
|
10
17
|
## [0.1.1] - 2026-07-06
|
|
11
18
|
|
|
12
19
|
### Fixed
|
|
@@ -45,7 +45,11 @@ module SchemaFerry
|
|
|
45
45
|
else
|
|
46
46
|
emit_warning "column #{raw[:name].inspect}: BIGINT UNSIGNED has no PostgreSQL " \
|
|
47
47
|
"integer equivalent; mapped to decimal(20, 0)."
|
|
48
|
-
|
|
48
|
+
# AR's schema dumper renders decimal defaults as a string (e.g.
|
|
49
|
+
# `default: "0"`), not a numeric literal — match that representation
|
|
50
|
+
# or ridgepole re-applies the default on every run.
|
|
51
|
+
new_default = raw[:default]&.to_s
|
|
52
|
+
raw.merge(type: :decimal, limit: nil, precision: 20, scale: 0, default: new_default)
|
|
49
53
|
end
|
|
50
54
|
end
|
|
51
55
|
|
|
@@ -9,9 +9,15 @@ module SchemaFerry
|
|
|
9
9
|
|
|
10
10
|
# PG's default timestamp precision is 6. Spelling it out makes ridgepole
|
|
11
11
|
# see a diff against the PG export (which omits it) on every run.
|
|
12
|
-
DEFAULT_PRECISION_TYPES = %i[datetime
|
|
12
|
+
DEFAULT_PRECISION_TYPES = %i[datetime time].freeze
|
|
13
13
|
PG_DEFAULT_PRECISION = 6
|
|
14
14
|
|
|
15
|
+
# ActiveRecord's PostgreSQL adapter never honors a precision option on
|
|
16
|
+
# :timestamptz (only :datetime/:timestamp/:time do — see
|
|
17
|
+
# ActiveRecord::ConnectionAdapters::SchemaStatements#type_to_sql).
|
|
18
|
+
# Declaring one is always a lie, so it must never be emitted.
|
|
19
|
+
NO_PRECISION_TYPES = %i[timestamptz].freeze
|
|
20
|
+
|
|
15
21
|
DEFAULTS = {
|
|
16
22
|
json: :jsonb
|
|
17
23
|
}.freeze
|
|
@@ -58,6 +64,7 @@ module SchemaFerry
|
|
|
58
64
|
end
|
|
59
65
|
|
|
60
66
|
def strip_default_precision(pg_type, options)
|
|
67
|
+
options[:precision] = nil if NO_PRECISION_TYPES.include?(pg_type)
|
|
61
68
|
return unless DEFAULT_PRECISION_TYPES.include?(pg_type)
|
|
62
69
|
|
|
63
70
|
options[:precision] = nil if options[:precision] == PG_DEFAULT_PRECISION
|
data/lib/schema_ferry/version.rb
CHANGED