generated_schema_validations 0.5.0 → 0.5.1

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: 0ab852e62f93186581c39db4f69ba44c3d14a7cdfa70af2964c44c6ce33dea8c
4
- data.tar.gz: b1825adcc71a209f86861ff198c282e90ac08a178915166e5b08d689cb1ed0f4
3
+ metadata.gz: 5eb0b94787c5c2fa3dd63dfd3b0f60f15b4b109813ffcc9839bb28491eb11924
4
+ data.tar.gz: 247d7ce6faf3829e0710ed5c6ed1d962b7ffc5e3e2b7baeb72b0b44d69f6887b
5
5
  SHA512:
6
- metadata.gz: 6192c01bbaf71055b38e23a6c7cf29dcd3781f2a9a2cd17932af868c7db50747a79591309549ae35fbe1bc9a3dfeea688974e5c3f6024e98a6fcb76f8fd3c986
7
- data.tar.gz: cb4c78ea96469157aaf66d14589cfaef5edc0c8532f9f159f67795cac70e7c669377a639829bb124dd8f103df481988669e7947c9471c89842b18afa6bce37ec
6
+ metadata.gz: 8d7baeb772e414b39dd83be6e1bbd40af2494b227de222c6c3ed907ea5b2598d976cfde3c5f74df57280413366b3ec194f9b8324bba71ec772cead68e1b3c311
7
+ data.tar.gz: 7d87b3e7dfe1392ff49871f362658abcf712484c7f89bacf0124d52cb5c06cf18196ea25a5649b9d70fccbdba9b69cc9a81587caab8a9abd7fda292292c31d35
data/README.md CHANGED
@@ -97,6 +97,10 @@ You can watch changes on `schema_validations.rb` to understand the generated val
97
97
 
98
98
  ## Changelog
99
99
 
100
+ ### 0.5.1
101
+
102
+ * raise info about where-unique conditions only in local envs
103
+
100
104
  ### 0.5
101
105
 
102
106
  * Enables automatic testing after deployment using Capistrano to compare the online database with the local one and automatically warn of any differences.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'generated_schema_validations'
5
- spec.version = '0.5.0'
5
+ spec.version = '0.5.1'
6
6
  spec.authors = ['Georg Limbach']
7
7
  spec.email = ['georg.limbach@lichtbit.com']
8
8
 
@@ -13,7 +13,7 @@ namespace :generated_schema_validations do
13
13
  end
14
14
 
15
15
  local_file = 'app/models/concerns/schema_validations.rb'
16
- local_content = File.read(local_file)
16
+ local_content = File.read(local_file).strip
17
17
 
18
18
  within release_path do
19
19
  with(
@@ -21,7 +21,7 @@ namespace :generated_schema_validations do
21
21
  rails_groups: fetch(:rails_assets_groups),
22
22
  disable_database_environment_check: 1
23
23
  ) do
24
- dump_output = capture :rake, 'db:validation_dump_direct'
24
+ dump_output = capture(:rake, 'db:validation_dump_direct').strip
25
25
 
26
26
  if dump_output != local_content
27
27
  warn '❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌'
@@ -151,7 +151,7 @@ class GeneratedSchemaValidations::Table
151
151
  return unless index_options[:unique]
152
152
  return unless names.all? { |name| name.to_s.in?(@column_names) }
153
153
 
154
- if defined?(Rails::Railtie) && (Rails.env.development? || Rails.env.test?) && index_options[:where]
154
+ if index_options[:where]
155
155
  @bad_indexes.push(names.map(&:to_s))
156
156
  else
157
157
  @unique_indexes.push(names.map(&:to_s))
@@ -55,6 +55,8 @@ module SchemaValidations
55
55
  unique_indexes.each do |names|
56
56
  names.each do |name|
57
57
  next if name.to_sym.in?(schema_validations_excluded_columns)
58
+ next unless defined?(Rails::Railtie)
59
+ next unless (Rails.env.development? || Rails.env.test?)
58
60
 
59
61
  raise "Unique index with where clause is outside the scope of this gem.\n\n" \
60
62
  "You can exclude this column: `schema_validations exclude: [:#{name}]`"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: generated_schema_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Limbach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-03 00:00:00.000000000 Z
11
+ date: 2025-12-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: After each migration it generates a file with some validations. Each
14
14
  active record should include this file and can uns generated validations.