activerecord-postgres_enum 1.2.0 → 1.3.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: 2e453014b2e32bcb23b20fd8c1f2dbb628690f303a61368bfad37564868244e4
|
4
|
+
data.tar.gz: 55b98925e297a91892c5c284e53564a6012cdb82e2494b93505974207e8d7de2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e0ba20aeaf52968c9022fca7aed356272ad2deb9883c98020d0bcdc17dfa73786fac4776f1f8cd02b45babe4a1344b5bcf9e516b8c3161275713910babc797
|
7
|
+
data.tar.gz: 66fd78a22198c3326b66ce410fac6782599164d3087473b1e3d5550e94801af37407d85786ca38c5f4c5c0503b5320dcde7c377a5d1ef3f94db72f4b236a73f2
|
@@ -42,13 +42,19 @@ module ActiveRecord
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def create_enum(name, values)
|
45
|
+
def create_enum(name, values, if_not_exists: nil)
|
46
|
+
return if if_not_exists && enums.include?(name.to_sym)
|
47
|
+
|
46
48
|
values = values.map { |v| quote v }
|
47
49
|
execute "CREATE TYPE #{name} AS ENUM (#{values.join(', ')})"
|
48
50
|
end
|
49
51
|
|
50
|
-
def drop_enum(name)
|
51
|
-
|
52
|
+
def drop_enum(name, cascade: nil, if_exists: nil)
|
53
|
+
if_exists_statement = 'IF EXISTS' if if_exists
|
54
|
+
cascade_statement = 'CASCADE' if cascade
|
55
|
+
|
56
|
+
sql = "DROP TYPE #{if_exists_statement} #{name} #{cascade_statement}"
|
57
|
+
execute sql
|
52
58
|
end
|
53
59
|
|
54
60
|
def rename_enum(name, new_name)
|
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.3.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-07-
|
11
|
+
date: 2020-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|