activerecord-postgres_enum 1.3.0 → 1.4.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27d16c338c8dcb14b9746be0e941981230c9a7eee7e4704755da15ed9869025a
|
4
|
+
data.tar.gz: 5077374a8566971f0236c67e4d52ae0467659f5fe14d384ec331bb58bbfb2df3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a58d412d08199ef784ec320d8534c39b58d150c7bc423aa493ac50602edbb9bd20e6cd176e989ec6629659ceb53117576ae98fb27ba0be9186d5c6bda6d11527
|
7
|
+
data.tar.gz: 39a6e9e9bb211cc7c3931f13459b83bf747398d0b0b94df3da0f9471565931b553beedb08b9e645c13654c5e1231f6c99b37c303133a454b80a5ce10c3e8b8ea
|
@@ -42,9 +42,11 @@ module ActiveRecord
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def create_enum(name, values, if_not_exists: nil)
|
45
|
+
def create_enum(name, values, force: false, if_not_exists: nil)
|
46
46
|
return if if_not_exists && enums.include?(name.to_sym)
|
47
47
|
|
48
|
+
drop_enum(name, cascade: force == :cascade, if_exists: true) if force
|
49
|
+
|
48
50
|
values = values.map { |v| quote v }
|
49
51
|
execute "CREATE TYPE #{name} AS ENUM (#{values.join(', ')})"
|
50
52
|
end
|
@@ -17,10 +17,10 @@ module ActiveRecord
|
|
17
17
|
|
18
18
|
@connection.enums.each do |name, values|
|
19
19
|
values = values.map { |v| " #{v.inspect}," }.join("\n")
|
20
|
-
statements << " create_enum #{name.inspect}, [\n#{values}\n ]"
|
20
|
+
statements << " create_enum #{name.inspect}, [\n#{values}\n ], force: :cascade"
|
21
21
|
end
|
22
22
|
|
23
|
-
stream.puts statements.join("\n")
|
23
|
+
stream.puts statements.join("\n\n")
|
24
24
|
stream.puts
|
25
25
|
end
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-postgres_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Merkushin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
172
|
requirements:
|
173
173
|
- - ">="
|
174
174
|
- !ruby/object:Gem::Version
|
175
|
-
version: '
|
175
|
+
version: '2.5'
|
176
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - ">="
|