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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23144c2fac25e5be5c8965155dc54b03b8859063fe00a43d033e9c3bed415f8a
4
- data.tar.gz: e40e59a694376551d73261e59d214e8ebfe460ee0ab5961116873a22bc9b019f
3
+ metadata.gz: 8c9c1befe1200c2536f27cf80f99dc05d1b825745c1d01c13499dae96275b61f
4
+ data.tar.gz: 8e8cc6b87918d25303c668c1cbe2fbfd4129c937bac9b83284a7ea639fb42453
5
5
  SHA512:
6
- metadata.gz: a1ff650538cacd552d26399df13507a0e4f5a71581e32bff0d1e2686ea3d8b8a86e44ef96a7143892ef7cef79a720135489ac174b09ade876b722465b916fc18
7
- data.tar.gz: 977f7a020023cad34941b24046982d0563f30340cfefe6a196feb83915c7ec5d6a148707cc596749ad0d2ced9a5e64ec55c926d6869d3bd0c853edbd4617dbd8
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AfterMigrate
4
- VERSION = '0.2.5'
4
+ VERSION = '0.2.6'
5
5
  end
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.5
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
@@ -1,2 +0,0 @@
1
- .ai/
2
- .claude/