generated_schema_validations 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +9 -1
- data/generated_schema_validations.gemspec +1 -1
- data/lib/generated_schema_validations/dumper.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8a2504a7047ebe796e668a73b2920b0113e0c38b9c514a5f652f8e524f2696b
|
4
|
+
data.tar.gz: 42f4ad881435d17cbad568bf4a704bdb04a3c8ab1d713752ae9401b4f19d0931
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 730fb6c7de51578b874f0e22d7b02089384849a6fa22252ed105b4b3c74a3ed2bbd9c1ba2f4ed03a2f336a28c49cd5c3e784807375a317434d28b239d613d255
|
7
|
+
data.tar.gz: 9e19c517659c728540736cef20a72944cb9ac568268e047888402fd6833c2281e94733b24d858dbb26ffff738eb8138f31fcb29146c0271b80c76623f4cacef9
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -27,7 +27,7 @@ To generate `app/models/concerns/schema_validations.rb`:
|
|
27
27
|
|
28
28
|
### Use validations
|
29
29
|
|
30
|
-
Add to `app/
|
30
|
+
Add to `app/models/application_record.rb`:
|
31
31
|
|
32
32
|
```ruby
|
33
33
|
class ApplicationRecord < ActiveRecord::Base
|
@@ -95,6 +95,14 @@ You can watch changes on `schema_validations.rb` to understand the generated val
|
|
95
95
|
|
96
96
|
## Changelog
|
97
97
|
|
98
|
+
### 0.2.2
|
99
|
+
|
100
|
+
* Enable rails 7.0 usage
|
101
|
+
|
102
|
+
### 0.2.1
|
103
|
+
|
104
|
+
* Close tempfile before reading
|
105
|
+
|
98
106
|
### 0.2.0
|
99
107
|
|
100
108
|
* Add validations of date and datetime columns to be in database range
|
@@ -7,14 +7,14 @@ class GeneratedSchemaValidations::Dumper
|
|
7
7
|
file = Tempfile.new(['schema', '.rb'])
|
8
8
|
begin
|
9
9
|
schema_content = File.read(Rails.root.join('db/schema.rb'))
|
10
|
-
schema_content.gsub!(
|
10
|
+
schema_content.gsub!(/ActiveRecord::Schema(\[[^\]]+\])?/, 'GeneratedSchemaValidations::Dumper')
|
11
11
|
raise 'The scheme is not well-formed.' if schema_content.include?('ActiveRecord')
|
12
12
|
|
13
13
|
file.write(schema_content)
|
14
|
+
file.close
|
14
15
|
|
15
16
|
load file.path
|
16
17
|
ensure
|
17
|
-
file.close
|
18
18
|
file.unlink
|
19
19
|
end
|
20
20
|
end
|
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.2.
|
4
|
+
version: 0.2.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: 2022-
|
11
|
+
date: 2022-10-21 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.
|