exwiw 0.4.7 → 0.4.9
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 +26 -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: b096127aa5a8f1a530af7967ac092c11ab7dd57a88ddb82697386d9ac1791e3d
|
|
4
|
+
data.tar.gz: 519ffff515c719d245bb32b9c1b0a64c6ff988502bc39a6af661962506f199be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 141955fba03d98e9cddead32de182db1d4e116b2ef758723478528c552ff27eadd6f88ef96587c14c543caaebf16accaa88c62a0e0c84d65e0c3d0abee3d0574
|
|
7
|
+
data.tar.gz: 2f284c6753f957a58bbbaa4736a3fed95e55263b6b15b3434cefa70b0de0907fb3c12ce770c58c1cf94fe757ee962d5d27e1a97cff62221a9f756c2a99c70947
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.4.9] - 2026-06-11
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- 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.
|
|
10
|
+
|
|
11
|
+
## [0.4.8] - 2026-06-11
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- PostgreSQL: schema dump now includes `CREATE EXTENSION IF NOT EXISTS` statements for user-installed extensions (e.g. `btree_gist`, `pgcrypto`, `uuid-ossp`). Extensions are emitted before any `CREATE TYPE` or `CREATE TABLE` definitions so the dump can be restored on a clean database without manually pre-installing extensions. Non-public schema extensions include a `SCHEMA` clause. ([#92](https://github.com/heyinc/exwiw/pull/92))
|
|
16
|
+
|
|
5
17
|
## [0.4.7] - 2026-06-10
|
|
6
18
|
|
|
7
19
|
### Fixed
|
|
@@ -52,6 +52,7 @@ module Exwiw
|
|
|
52
52
|
raise "pg_dump failed (exit #{status.exitstatus}): #{stderr}"
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
# Enums are prepended first, then extensions — so extensions end up at the top of the output.
|
|
55
56
|
enum_types = query_enum_types(table_names)
|
|
56
57
|
unless enum_types.empty?
|
|
57
58
|
enum_ddl = DdlPostprocessor.create_type_enum_statements(enum_types)
|
|
@@ -59,6 +60,17 @@ module Exwiw
|
|
|
59
60
|
stdout = enum_ddl + stdout
|
|
60
61
|
end
|
|
61
62
|
|
|
63
|
+
extensions = query_extensions
|
|
64
|
+
unless extensions.empty?
|
|
65
|
+
ext_ddl = extensions.map do |extname, schema|
|
|
66
|
+
stmt = "CREATE EXTENSION IF NOT EXISTS #{connection.quote_ident(extname)}"
|
|
67
|
+
stmt += " SCHEMA #{connection.quote_ident(schema)}" unless schema == "public"
|
|
68
|
+
"DO $$ BEGIN #{stmt}; EXCEPTION WHEN feature_not_supported THEN NULL; END $$;"
|
|
69
|
+
end.join("\n") + "\n\n"
|
|
70
|
+
@logger.debug(" Found #{extensions.size} extension(s) to prepend.")
|
|
71
|
+
stdout = ext_ddl + stdout
|
|
72
|
+
end
|
|
73
|
+
|
|
62
74
|
idempotent = stdout
|
|
63
75
|
idempotent = DdlPostprocessor.add_if_not_exists_to_create_schema(idempotent)
|
|
64
76
|
idempotent = DdlPostprocessor.add_if_not_exists_to_create_sequence(idempotent)
|
|
@@ -368,6 +380,20 @@ module Exwiw
|
|
|
368
380
|
end
|
|
369
381
|
end
|
|
370
382
|
|
|
383
|
+
private def query_extensions
|
|
384
|
+
sql = <<~SQL
|
|
385
|
+
SELECT e.extname, n.nspname
|
|
386
|
+
FROM pg_extension e
|
|
387
|
+
JOIN pg_namespace n ON n.oid = e.extnamespace
|
|
388
|
+
WHERE e.extname != 'plpgsql'
|
|
389
|
+
AND e.extname NOT LIKE 'google\\_%' ESCAPE '\\'
|
|
390
|
+
AND e.extname NOT LIKE 'rds\\_%' ESCAPE '\\'
|
|
391
|
+
AND e.extname NOT LIKE 'aiven\\_%' ESCAPE '\\'
|
|
392
|
+
ORDER BY e.extname
|
|
393
|
+
SQL
|
|
394
|
+
connection.exec(sql).map { |row| [row["extname"], row["nspname"]] }
|
|
395
|
+
end
|
|
396
|
+
|
|
371
397
|
private def query_enum_types(table_names)
|
|
372
398
|
return [] if table_names.empty?
|
|
373
399
|
|
data/lib/exwiw/version.rb
CHANGED