db_meta 0.14.0 → 0.14.1

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: 2a8daf933344c242f2d8b50b218bddb5a4cf488a729316ad11c658af6c5cb782
4
- data.tar.gz: b20f8d156bdfd1839d52781603a4abb83a099adfa415399acf53308cf887a566
3
+ metadata.gz: 613dba8df67586f3a98b0282ea2eba0acee08368b7842c3740624a03700b6feb
4
+ data.tar.gz: 2c727117d8873dd58a7753eb1e80032082dd4c3da3cc744b597091c3cb18af3a
5
5
  SHA512:
6
- metadata.gz: cdddc2bfff37d407e381f9a642dd586c6ecf728f3db170f9db6e0ffc03d4c999633ee8c840d80fb4c2ced75910e399f8ea063825000c143bd4df87ea725eb863
7
- data.tar.gz: 5ff480c88420a57634dc65bdd99dcf418a82bbd978457a42b8fd610c4c6d4896243f6b62fa312536b08efc4b21fc43ee4df90694b55c091a1d14c90d646e70d8
6
+ metadata.gz: e4c8637ed18a53a34be8fc9b0ba2b06460301f0883f757f4f9b9f409936338f0e230e46a8c8cc7cd3e0665d2c8551f703a13957676eadb1c64095f6e9e8b84a4
7
+ data.tar.gz: 91f156e1f312922e81ad795fd56a906a548bb3da5d3737a2cd394a68118a0cf3e6655e61b0bb0d175861db34a9b47ec074a443cd4adeb5322dbf7a503e3eae52
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [0.14.1] - 2026-04-28
2
+
3
+ ### Changed
4
+ - Sequences now extract with `START WITH <MINVALUE>` by default (previously `START WITH <LAST_NUMBER>`), so extracts are reproducible and comparable across instances of the same schema. Pass `preserve_sequence_position: true` to `extract` to keep the original live-position behavior.
5
+ - `INCREMENT BY` is now emitted for sequences (previously fetched but never written, so non-default increments produced incorrect DDL).
6
+
7
+ ### Fixed
8
+ - `Column#extract` now emits an explicit `NOT NULL` for non-nullable columns. Without this, 0.14.0 produced table DDL without any NOT NULL clauses because the previously-relied-on `SYS_*` NOT NULL CHECK constraints are now filtered out as redundant noise.
9
+
1
10
  ## [0.14.0] - 2026-04-28
2
11
 
3
12
  ### Changed
data/README.md CHANGED
@@ -39,6 +39,11 @@ A few decisions worth knowing about, especially if you compare extracts across i
39
39
 
40
40
  - **Auto-generated `SYS_*` constraint names are stripped from the output.** Oracle invents names like `SYS_C0012345` for unnamed constraints, and those names differ between instances — making schema diffs noisy. Constraints with a `SYS_*` name are emitted without an explicit `CONSTRAINT <name>` clause; on import, Oracle just generates a fresh name. User-given constraint names are preserved as-is.
41
41
  - **Redundant `NOT NULL` CHECK constraints are omitted.** Oracle exposes column-level `NOT NULL` both as a column attribute and as a `SYS_*` CHECK constraint with a body of `"COL" IS NOT NULL`. The column-level form is already in the table DDL, so the duplicate CHECK is filtered out.
42
+ - **Sequences start from their `MINVALUE`, not from the live `LAST_NUMBER`.** Oracle's `LAST_NUMBER` advances every time someone calls `NEXTVAL`, so emitting it would make extracts diverge between any two instances of the same schema. The default output therefore starts each sequence at its baseline (typically 1), so a fresh schema build is reproducible and diffs stay clean. If you're seeding a new schema alongside imported data and need sequences to continue past existing PK values, pass `preserve_sequence_position: true` to `extract`:
43
+
44
+ ```ruby
45
+ meta.extract(preserve_sequence_position: true)
46
+ ```
42
47
 
43
48
  ## Supported Databases
44
49
  - Oracle
@@ -7,6 +7,7 @@ module DbMeta
7
7
  buffer = ("%-30s" % @name).to_s
8
8
  buffer << " #{convert_type}"
9
9
  buffer << " DEFAULT #{@data_default.strip}" if @data_default.size > 0
10
+ buffer << " NOT NULL" if @nullable == "N"
10
11
  buffer
11
12
  end
12
13
 
@@ -22,9 +22,12 @@ module DbMeta
22
22
  end
23
23
 
24
24
  def extract(args = {})
25
+ start_value = args[:preserve_sequence_position] ? @last_number : @min_value
26
+
25
27
  buffer = [block(@name)]
26
28
  buffer << "CREATE SEQUENCE #{@name}"
27
- buffer << " START WITH #{@last_number}"
29
+ buffer << " START WITH #{start_value}"
30
+ buffer << " INCREMENT BY #{@increment_by}"
28
31
  buffer << " MAXVALUE #{@max_value}"
29
32
  buffer << " MINVALUE #{@min_value}"
30
33
  buffer << ((@cycle_flag == "N") ? " NOCYCLE" : " CYCLE")
@@ -1,3 +1,3 @@
1
1
  module DbMeta
2
- VERSION = "0.14.0"
2
+ VERSION = "0.14.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_meta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomi