generated_schema_validations 0.5.0 → 0.5.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 215e8be8d62e4824a9ebbd7eeb4e98152d7ca387b51737869a591fb563dcb1c9
|
|
4
|
+
data.tar.gz: ac0d3f763d6dc2fc810c6223154a2177cc7c72e9475a4eb2d6de452a74f82887
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 831c29092e640e421b03bc457c314fe440cb03d42ebd913736803ec12799246dc35436e573b78dce18972de857ee78d33e5b02974c980e7fbf75eca295baaa03
|
|
7
|
+
data.tar.gz: 196cc074bed35df2118ab7c3fbba5e3bafde6c9bdd9f5a73ddea86f749f0a26426fecc09bf2f0e686f2d9d99fea207a190de51d9aa125dd8101aeca6325afd1d
|
data/README.md
CHANGED
|
@@ -97,6 +97,14 @@ You can watch changes on `schema_validations.rb` to understand the generated val
|
|
|
97
97
|
|
|
98
98
|
## Changelog
|
|
99
99
|
|
|
100
|
+
### 0.5.2
|
|
101
|
+
|
|
102
|
+
* sort generated validates to ignore column order
|
|
103
|
+
|
|
104
|
+
### 0.5.1
|
|
105
|
+
|
|
106
|
+
* raise info about where-unique conditions only in local envs
|
|
107
|
+
|
|
100
108
|
### 0.5
|
|
101
109
|
|
|
102
110
|
* Enables automatic testing after deployment using Capistrano to compare the online database with the local one and automatically warn of any differences.
|
|
@@ -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
|
|
24
|
+
dump_output = capture(:rake, 'db:validation_dump_direct').strip
|
|
25
25
|
|
|
26
26
|
if dump_output != local_content
|
|
27
27
|
warn '❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌❌'
|
|
@@ -27,6 +27,12 @@ class GeneratedSchemaValidations::Table
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def to_s
|
|
30
|
+
# sort everything
|
|
31
|
+
@possible_belongs_to_not_null_columns.sort!
|
|
32
|
+
@bad_indexes.sort!
|
|
33
|
+
@unique_indexes.sort!
|
|
34
|
+
@validations.sort_by!(&:to_s)
|
|
35
|
+
|
|
30
36
|
string = "\n"
|
|
31
37
|
string += "def dbv_#{table_name}_validations(enums: [])\n"
|
|
32
38
|
if @possible_belongs_to_not_null_columns.present?
|
|
@@ -151,7 +157,7 @@ class GeneratedSchemaValidations::Table
|
|
|
151
157
|
return unless index_options[:unique]
|
|
152
158
|
return unless names.all? { |name| name.to_s.in?(@column_names) }
|
|
153
159
|
|
|
154
|
-
if
|
|
160
|
+
if index_options[:where]
|
|
155
161
|
@bad_indexes.push(names.map(&:to_s))
|
|
156
162
|
else
|
|
157
163
|
@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.
|
|
4
|
+
version: 0.5.2
|
|
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-
|
|
11
|
+
date: 2025-12-17 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.
|