after_migrate 0.2.5 → 0.2.6
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 +5 -0
- data/lib/after_migrate/adapters/postgresql.rb +12 -0
- data/lib/after_migrate/version.rb +1 -1
- metadata +1 -2
- data/.gitlocalexclude +0 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8c9c1befe1200c2536f27cf80f99dc05d1b825745c1d01c13499dae96275b61f
|
|
4
|
+
data.tar.gz: 8e8cc6b87918d25303c668c1cbe2fbfd4129c937bac9b83284a7ea639fb42453
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42015b8f9c703839c91318c2bc165ff924f3e0b65dd4a0e6e770721456be25f560ea5674f8b50638130fb9bcce4ea6033aeddad7f4893bf4a9db0fe70a03e1c1
|
|
7
|
+
data.tar.gz: bae706e4aaaa059698cc9e9fc45c1e4f05c32d0227b1408ba374359d44d3b1d7ab69e4ae9e450747032d0d27381bc394d8659772593525d45d06ef0e5a409ab4
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.2.6] - 2026-07-16
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- PostgreSQL `ANALYZE` now skips tables that were dropped by a migration instead of failing with `PG::UndefinedTable`, while still analyzing remaining affected tables and re-raising unrelated statement errors
|
|
9
|
+
|
|
5
10
|
## [0.2.4] - 2026-06-01
|
|
6
11
|
|
|
7
12
|
### Added
|
|
@@ -60,9 +60,21 @@ module AfterMigrate
|
|
|
60
60
|
end
|
|
61
61
|
AfterMigrate.log("ANALYZE VERBOSE #{table}")
|
|
62
62
|
connection.execute("ANALYZE#{AfterMigrate.configuration.verbose ? ' VERBOSE ' : ' '}#{table}")
|
|
63
|
+
rescue ActiveRecord::StatementInvalid => e
|
|
64
|
+
raise unless pg_undefined_table_error?(e)
|
|
65
|
+
|
|
66
|
+
AfterMigrate.log("Skipping ANALYZE for #{table} - table no longer exists")
|
|
63
67
|
end
|
|
64
68
|
end
|
|
65
69
|
|
|
70
|
+
def pg_undefined_table_error?(error)
|
|
71
|
+
return false unless Object.const_defined?(:PG)
|
|
72
|
+
|
|
73
|
+
error.cause.is_a?(Object.const_get(:PG).const_get(:UndefinedTable))
|
|
74
|
+
rescue NameError
|
|
75
|
+
false
|
|
76
|
+
end
|
|
77
|
+
|
|
66
78
|
def optimize_tables(table_names:, schema:, **)
|
|
67
79
|
cleaned_tables = []
|
|
68
80
|
cleaned_tables = run_vacuum(schema:, table_names:) if AfterMigrate.configuration.vacuum
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: after_migrate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nikolay Moskvin
|
|
@@ -48,7 +48,6 @@ extensions: []
|
|
|
48
48
|
extra_rdoc_files: []
|
|
49
49
|
files:
|
|
50
50
|
- ".gitignore"
|
|
51
|
-
- ".gitlocalexclude"
|
|
52
51
|
- ".rspec"
|
|
53
52
|
- ".rubocop.yml"
|
|
54
53
|
- ".ruby-version"
|
data/.gitlocalexclude
DELETED