db_meta 0.14.1 → 0.14.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: 613dba8df67586f3a98b0282ea2eba0acee08368b7842c3740624a03700b6feb
4
- data.tar.gz: 2c727117d8873dd58a7753eb1e80032082dd4c3da3cc744b597091c3cb18af3a
3
+ metadata.gz: de691cf6d95cc673acb6752f4033c064cfd83b32e3af2bed8d65cb4f29d31c5b
4
+ data.tar.gz: 25ce64608c0ad4c613a78083391f463e5d2f3831c7bc88b4ad31dedeaca9ce18
5
5
  SHA512:
6
- metadata.gz: e4c8637ed18a53a34be8fc9b0ba2b06460301f0883f757f4f9b9f409936338f0e230e46a8c8cc7cd3e0665d2c8551f703a13957676eadb1c64095f6e9e8b84a4
7
- data.tar.gz: 91f156e1f312922e81ad795fd56a906a548bb3da5d3737a2cd394a68118a0cf3e6655e61b0bb0d175861db34a9b47ec074a443cd4adeb5322dbf7a503e3eae52
6
+ metadata.gz: ea9a6251cabb8a5283cbab32a9ed4be4af90b96c99317557fdc346c3564a697d8101bf75245a4456c1cd76709f26c68802bdd0285b1af79748cd862a0244bed3
7
+ data.tar.gz: a9f6d794b95dc82694d95fc528199788c0d1b0ed0efd438b70def9c08d7b0f25bdb0771c32dd4c40f23fcc8127ef70456f7185eb9aa3182382e010f6aaf1e42a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.14.2] - 2026-04-28
2
+
3
+ ### Changed
4
+ - Materialized views with a refresh interval are extracted as `START WITH SYSDATE NEXT <interval>` by default, instead of using the live `USER_REFRESH.NEXT_DATE`. The next_date advances on every refresh cycle and made schema diffs noisy across instances. Pass `preserve_mview_schedule: true` to `extract` to keep the original `TO_DATE(...)` form when the exact next-refresh moment matters.
5
+
1
6
  ## [0.14.1] - 2026-04-28
2
7
 
3
8
  ### Changed
data/README.md CHANGED
@@ -39,6 +39,7 @@ 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
+ - **Materialized views use `START WITH SYSDATE` for their refresh schedule.** Oracle's `USER_REFRESH.NEXT_DATE` advances on every refresh cycle, so emitting it would make the DDL diverge between instances. The default output therefore writes `START WITH SYSDATE NEXT <interval>`, which is the idiomatic hand-written form and resolves at script-execution time. Note that Oracle does not preserve the *originally specified* start date in its data dictionary — once an MV has refreshed at least once, the original is gone — so there's no way to round-trip an explicit user-given start. Pass `preserve_mview_schedule: true` to `extract` to keep the live `TO_DATE(...)` form when the exact next-refresh moment matters.
42
43
  - **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
 
44
45
  ```ruby
@@ -40,7 +40,10 @@ module DbMeta
40
40
  buffer << "CREATE MATERIALIZED VIEW #{@name}(#{@columns.map { |c| c.name }.join(", ")})"
41
41
  buffer << "BUILD #{@build_mode}"
42
42
  buffer << "REFRESH #{@refresh_method} ON #{@refresh_mode}"
43
- buffer << "START WITH TO_DATE('#{@next_date}') NEXT #{@interval}" if @interval
43
+ if @interval
44
+ start_clause = args[:preserve_mview_schedule] ? "TO_DATE('#{@next_date}')" : "SYSDATE"
45
+ buffer << "START WITH #{start_clause} NEXT #{@interval}"
46
+ end
44
47
  buffer << "#{@rewrite_enabled} QUERY REWRITE"
45
48
  buffer << "AS"
46
49
  buffer << @query
@@ -1,3 +1,3 @@
1
1
  module DbMeta
2
- VERSION = "0.14.1"
2
+ VERSION = "0.14.2"
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.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomi