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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a34cb64f18cd33a93ebbc3636bd1e76e170279d98ec5d9c59b8ef14e8f141fd9
4
- data.tar.gz: f3ae1fbea45f7b7f5c4d5c79e5704fcc680955a77a9123a73975618c32752b8f
3
+ metadata.gz: ffeee05f1fb01ebb90d2a75df3077d46788714b4aa192de62f7f9b4f62c1824c
4
+ data.tar.gz: 4977e0f544613fd09d6d61674407b281463e2fca75770d8b21aea0e60f94de44
5
5
  SHA512:
6
- metadata.gz: 9fa8d644af36d128f1922258299fc96ba682a068f1195fced8e8446e64067c63e5d5ee81b3541f07e162d0e2588495946e111ca5076da608ab9054491f9a8cdd
7
- data.tar.gz: 18dd78144c3e9ccbba232da685b0248eb22be16a73ac55090edfe6638a7d93d8ef794bcf1babad248a95f324b9bf8a3e4bac4e3db19a2b4d735d09dd45a9cffe
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
- # 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)
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 MySQL-derived
7
- # limits.
8
- LIMIT_STRIPPED_TYPES = %i[text binary bigint].freeze
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
- # PG numeric(20) equals numeric(20,0) and is exported without scale.
47
- adjusted[:scale] = nil if pg_type == :decimal && adjusted[:scale]&.zero?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SchemaFerry
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_ferry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kyuuri1791