exwiw 0.4.8 → 0.4.10
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 +12 -0
- data/lib/exwiw/adapter/postgresql_adapter.rb +5 -1
- data/lib/exwiw/ddl_postprocessor.rb +6 -0
- data/lib/exwiw/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: a89e3da8899badc5bcccc98f58878744b9b106b31ca38af6a70b41109002d126
|
|
4
|
+
data.tar.gz: 13dd0757b0699c7865cd4c89b214288d16d017a9447c042e90c3da5cedc6f4b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b04b7e070c1215b24c6dfa6453e572bf560d77fbd9a6eb6172fbd301a8b662ebc1da815f13d5fb4ba31799a5e8e45c610c0271e810eff6c8c675e75fcf261e2d
|
|
7
|
+
data.tar.gz: 4b88cfc7ed7a758b7a82b76d9e936c251b388825411fef9c305434919b7695f6866e5011828a6a2bf00c95692d157c1f0e4e768e0dc3e9ab79b980f025e4c626
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.4.10] - 2026-06-12
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- PostgreSQL: schema dump now strips `CREATE TRIGGER` statements from `insert-000-schema.sql`. `pg_dump --table` includes triggers but not the standalone function definitions they reference, causing `PG::UndefinedFunction` errors on restore. Handles `CREATE CONSTRAINT TRIGGER` and `CREATE OR REPLACE TRIGGER` variants. ([#96](https://github.com/heyinc/exwiw/pull/96))
|
|
10
|
+
|
|
11
|
+
## [0.4.9] - 2026-06-11
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- PostgreSQL: schema dump now filters cloud-provider-managed extensions (`google_%`, `rds_%`, `aiven_%`) and wraps remaining `CREATE EXTENSION` statements in exception handling (`EXCEPTION WHEN feature_not_supported THEN NULL`), so dumps extracted from GCP Cloud SQL can be restored on AWS RDS without manual intervention.
|
|
16
|
+
|
|
5
17
|
## [0.4.8] - 2026-06-11
|
|
6
18
|
|
|
7
19
|
### Added
|
|
@@ -65,7 +65,7 @@ module Exwiw
|
|
|
65
65
|
ext_ddl = extensions.map do |extname, schema|
|
|
66
66
|
stmt = "CREATE EXTENSION IF NOT EXISTS #{connection.quote_ident(extname)}"
|
|
67
67
|
stmt += " SCHEMA #{connection.quote_ident(schema)}" unless schema == "public"
|
|
68
|
-
"#{stmt};"
|
|
68
|
+
"DO $$ BEGIN #{stmt}; EXCEPTION WHEN feature_not_supported THEN NULL; END $$;"
|
|
69
69
|
end.join("\n") + "\n\n"
|
|
70
70
|
@logger.debug(" Found #{extensions.size} extension(s) to prepend.")
|
|
71
71
|
stdout = ext_ddl + stdout
|
|
@@ -77,6 +77,7 @@ module Exwiw
|
|
|
77
77
|
idempotent = DdlPostprocessor.add_if_not_exists_to_create_table(idempotent)
|
|
78
78
|
idempotent = DdlPostprocessor.add_if_not_exists_to_create_index(idempotent)
|
|
79
79
|
idempotent = DdlPostprocessor.wrap_add_constraint_in_do_block(idempotent)
|
|
80
|
+
idempotent = DdlPostprocessor.strip_triggers(idempotent)
|
|
80
81
|
|
|
81
82
|
File.open(output_path, 'w') do |file|
|
|
82
83
|
file.puts("-- Auto-generated by exwiw via pg_dump. Idempotent DDL for postgresql.")
|
|
@@ -386,6 +387,9 @@ module Exwiw
|
|
|
386
387
|
FROM pg_extension e
|
|
387
388
|
JOIN pg_namespace n ON n.oid = e.extnamespace
|
|
388
389
|
WHERE e.extname != 'plpgsql'
|
|
390
|
+
AND e.extname NOT LIKE 'google\\_%' ESCAPE '\\'
|
|
391
|
+
AND e.extname NOT LIKE 'rds\\_%' ESCAPE '\\'
|
|
392
|
+
AND e.extname NOT LIKE 'aiven\\_%' ESCAPE '\\'
|
|
389
393
|
ORDER BY e.extname
|
|
390
394
|
SQL
|
|
391
395
|
connection.exec(sql).map { |row| [row["extname"], row["nspname"]] }
|
|
@@ -58,6 +58,12 @@ module Exwiw
|
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
# pg_dump --table includes triggers but not the referenced function
|
|
62
|
+
# definitions, causing UndefinedFunction errors on the target DB.
|
|
63
|
+
def strip_triggers(sql)
|
|
64
|
+
sql.gsub(/^[ \t]*CREATE\s+(?:OR\s+REPLACE\s+)?(?:CONSTRAINT\s+)?TRIGGER\b[^;]*;\r?\n?/i, "")
|
|
65
|
+
end
|
|
66
|
+
|
|
61
67
|
# Generate idempotent CREATE TYPE ... AS ENUM statements.
|
|
62
68
|
# +enum_types+ is an Array of Hashes with keys :schema, :name, :labels.
|
|
63
69
|
def create_type_enum_statements(enum_types)
|
data/lib/exwiw/version.rb
CHANGED