db_meta 0.14.0 → 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 +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +6 -0
- data/lib/db_meta/oracle/types/column.rb +1 -0
- data/lib/db_meta/oracle/types/materialized_view.rb +4 -1
- data/lib/db_meta/oracle/types/sequence.rb +4 -1
- data/lib/db_meta/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: de691cf6d95cc673acb6752f4033c064cfd83b32e3af2bed8d65cb4f29d31c5b
|
|
4
|
+
data.tar.gz: 25ce64608c0ad4c613a78083391f463e5d2f3831c7bc88b4ad31dedeaca9ce18
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea9a6251cabb8a5283cbab32a9ed4be4af90b96c99317557fdc346c3564a697d8101bf75245a4456c1cd76709f26c68802bdd0285b1af79748cd862a0244bed3
|
|
7
|
+
data.tar.gz: a9f6d794b95dc82694d95fc528199788c0d1b0ed0efd438b70def9c08d7b0f25bdb0771c32dd4c40f23fcc8127ef70456f7185eb9aa3182382e010f6aaf1e42a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
6
|
+
## [0.14.1] - 2026-04-28
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- 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.
|
|
10
|
+
- `INCREMENT BY` is now emitted for sequences (previously fetched but never written, so non-default increments produced incorrect DDL).
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- `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.
|
|
14
|
+
|
|
1
15
|
## [0.14.0] - 2026-04-28
|
|
2
16
|
|
|
3
17
|
### Changed
|
data/README.md
CHANGED
|
@@ -39,6 +39,12 @@ 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.
|
|
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`:
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
meta.extract(preserve_sequence_position: true)
|
|
47
|
+
```
|
|
42
48
|
|
|
43
49
|
## Supported Databases
|
|
44
50
|
- Oracle
|
|
@@ -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
|
-
|
|
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
|
|
@@ -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 #{
|
|
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")
|
data/lib/db_meta/version.rb
CHANGED