schema_ferry 0.1.2 → 0.1.3
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/schema_ferry/converter/column_converter.rb +1 -5
- data/lib/schema_ferry/converter/type_mapper.rb +13 -5
- data/lib/schema_ferry/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: ffeee05f1fb01ebb90d2a75df3077d46788714b4aa192de62f7f9b4f62c1824c
|
|
4
|
+
data.tar.gz: 4977e0f544613fd09d6d61674407b281463e2fca75770d8b21aea0e60f94de44
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9fc86363dac3a3bcb9e4bbf852ef3a5f5ea7113dbf6c9722cf0741b666b49da056b4334d866fec935e4255aff0ae72ffa943d1b028f966edfc5caa433a04f6ca
|
|
7
|
+
data.tar.gz: a6a95a90bfd5ddbcbfcc4bc25de2ab3036c68f5d9d272478bf74a1c0980ca8fb19bf1c01425db83cbc6b0ed87adac02a64ff0977b91d12d5cbc30e57fda909ae
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.3] - 2026-07-06
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- The 0.1.2 fix only covered the two reported cases, not the underlying pattern: any type/option combination that PostgreSQL can't actually reproduce back to ActiveRecord causes `apply!` to re-run `change_column` forever, because ridgepole compares the declaration against a state it can never match.
|
|
15
|
+
- `DOUBLE` columns (`:float`) are read with `limit: 53` (the type's internal bit width), but a PostgreSQL column never reports a limit back. `limit` is no longer emitted for `:float` columns.
|
|
16
|
+
- Plain `DECIMAL` columns with a default (not just ones bumped from `BIGINT UNSIGNED`) now render their default as a string, matching the form ActiveRecord's schema dumper uses for decimal defaults — the same fix from 0.1.2, generalized to `TypeMapper` so it applies to every decimal column instead of only the unsigned-bigint conversion path.
|
|
17
|
+
|
|
10
18
|
## [0.1.2] - 2026-07-06
|
|
11
19
|
|
|
12
20
|
### Fixed
|
|
@@ -45,11 +45,7 @@ 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
|
-
|
|
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)
|
|
48
|
+
raw.merge(type: :decimal, limit: nil, precision: 20, scale: 0)
|
|
53
49
|
end
|
|
54
50
|
end
|
|
55
51
|
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
module SchemaFerry
|
|
4
4
|
module Converter
|
|
5
5
|
class TypeMapper
|
|
6
|
-
# PG has no limit concept for text/binary/bigint; drop the
|
|
7
|
-
# limits
|
|
8
|
-
|
|
6
|
+
# PG has no limit concept for text/binary/bigint/float; drop the
|
|
7
|
+
# MySQL-derived limits (float's limit: 53 is DOUBLE's internal bit
|
|
8
|
+
# width, not something AR ever reads back from a PG column).
|
|
9
|
+
LIMIT_STRIPPED_TYPES = %i[text binary bigint float].freeze
|
|
9
10
|
|
|
10
11
|
# PG's default timestamp precision is 6. Spelling it out makes ridgepole
|
|
11
12
|
# see a diff against the PG export (which omits it) on every run.
|
|
@@ -43,8 +44,15 @@ module SchemaFerry
|
|
|
43
44
|
pg_type, adjusted = normalize_integer(adjusted) if pg_type == :integer
|
|
44
45
|
adjusted.delete(:limit) if LIMIT_STRIPPED_TYPES.include?(pg_type)
|
|
45
46
|
strip_default_precision(pg_type, adjusted)
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
if pg_type == :decimal
|
|
48
|
+
# PG numeric(20) equals numeric(20,0) and is exported without scale.
|
|
49
|
+
adjusted[:scale] = nil if adjusted[:scale]&.zero?
|
|
50
|
+
# AR's schema dumper renders decimal defaults as a string (e.g.
|
|
51
|
+
# `default: "0"`), not a numeric literal. ridgepole compares against
|
|
52
|
+
# that dumped form, so a BigDecimal/Integer default never matches
|
|
53
|
+
# and gets re-applied on every run.
|
|
54
|
+
adjusted[:default] = adjusted[:default]&.to_s
|
|
55
|
+
end
|
|
48
56
|
|
|
49
57
|
[pg_type, adjusted]
|
|
50
58
|
end
|
data/lib/schema_ferry/version.rb
CHANGED