database_consistency 1.7.25 → 1.7.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a60adb5b04de89499434019dd7ae4d0281799fc457122de1d01ad825d9d74e1
4
- data.tar.gz: 3cfe216adacba3de2df73bf8cc353ce56bbdae93c0b4ada74b860cd89422f173
3
+ metadata.gz: 5ba4d8b566474e443336b5b7c471ad85bb492581847cb721daa5ba41be272bc0
4
+ data.tar.gz: c5c80cbfd15eae2e8b948cc44233d1c2c74a67a734ee0867a30defd3ed8a877d
5
5
  SHA512:
6
- metadata.gz: d522414bc1680d596f9207c95615265befd75535e145c43bd7056c823a160a3620e4a9f5ce28b04b0d00878349e8a21d5b58fda669b6510bd714a355791aa8c6
7
- data.tar.gz: be1853d66bf896d3ab6eae46684e8533177d90394de2d7360e2e613a3b61e050578fdd0b48a1b357c26171b4c14fedf54f74f064ba0854bdb17026730e2b58a9
6
+ metadata.gz: 5d49d5e2e5f15577114ae6adaa8453db9ad9573bd0af6f0bc2eafb8319b30a04fae8f7ef6005e7c5990da1686d79a1d5e58ac535a182152767bf68764daf4edb
7
+ data.tar.gz: f9a07275157c90e2e20b04706a5f6b95974918d7c0716ea16f91cd2737a4b60bc0a82b65f9f2e8a286c1f9d3976d1d0f4f78b0dabc832079c37644010a8563d6
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DatabaseConsistency
4
- VERSION = '1.7.25'
4
+ VERSION = '1.7.27'
5
5
  end
@@ -6,10 +6,7 @@ module DatabaseConsistency
6
6
  module Helpers
7
7
  module Migration # :nodoc:
8
8
  def migration_path(name)
9
- migration_paths = ActiveRecord::Migrator.migrations_paths
10
- schema_migration = ActiveRecord::Base.connection.schema_migration
11
-
12
- last = ActiveRecord::MigrationContext.new(migration_paths, schema_migration).migrations.last
9
+ last = migration_context.migrations.last
13
10
  version = ActiveRecord::Migration.next_migration_number(last&.version.to_i + 1)
14
11
 
15
12
  "db/migrate/#{version}_#{name.underscore}.rb"
@@ -25,6 +22,21 @@ module DatabaseConsistency
25
22
  migration_version: ActiveRecord::Migration.current_version
26
23
  }
27
24
  end
25
+
26
+ def migration_context
27
+ if ActiveRecord::MigrationContext.instance_method(:initialize).arity == 1
28
+ return ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
29
+ end
30
+
31
+ if ActiveRecord::Base.connection.respond_to?(:schema_migration)
32
+ return ActiveRecord::MigrationContext.new(
33
+ ActiveRecord::Migrator.migrations_paths,
34
+ ActiveRecord::Base.connection.schema_migration
35
+ )
36
+ end
37
+
38
+ ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
39
+ end
28
40
  end
29
41
  end
30
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_consistency
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.25
4
+ version: 1.7.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evgeniy Demin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-24 00:00:00.000000000 Z
11
+ date: 2024-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - ">"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '1.3'
139
- description:
139
+ description:
140
140
  email:
141
141
  - lawliet.djez@gmail.com
142
142
  executables:
@@ -273,9 +273,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
273
  - !ruby/object:Gem::Version
274
274
  version: '0'
275
275
  requirements: []
276
- rubygems_version: 3.4.1
277
- signing_key:
276
+ rubygems_version: 3.2.33
277
+ signing_key:
278
278
  specification_version: 4
279
279
  summary: Provide an easy way to check the consistency of the database constraints
280
280
  with the application validations.
281
281
  test_files: []
282
+ ...