activerecord-postgres_enum 0.3.0 → 0.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: c68566d10f50ac8201be6fef301800d43510eaaec25464fa8eb84166c9c999c8
4
- data.tar.gz: df6c0c72b1cb347fa0273bc545bc6512b354d7db768b570a64cd77f92b3aee20
3
+ metadata.gz: 8126b681a13ce0266aff512380576a00a47a93a7a018a507dbda0a18ffa7e775
4
+ data.tar.gz: 3190be425e34c6c3c7116b46afb5fa671e573d831afcbfb3b36ef8ef7b169d23
5
5
  SHA512:
6
- metadata.gz: 8aa9af3d60353212b85d1f2373464dce9a370e0d16629e9310c240085bd28e3e8a2eab38922365784ce5be45ead41d577c4cbbe6c80523406346f8dd8b7dbe2c
7
- data.tar.gz: 1565021cfb38112174caff888368d96b97f31717cc59d1da370cb10cecab11c4fd513467f1ae30e84bbbc014c21183d7e18efdd61586dad78cdecb449a4c7a72
6
+ metadata.gz: 5e7e17e5b245b285ec234cf069d31c98d54e5f2f043247ef81956c72859a0f72ccb6ca28dccffcc2e6ac4d318a4fe916982c18a1a338b82f6ccebb1b0fcfd582
7
+ data.tar.gz: e03ab649fc29e58f7938da1a30648acebe23af42efde515b0241ceb338ec3f7d4e9638d6f15f07aa91a7b9c4fc477ef85521e8b912677ceeac3f3ef06daf6d30
@@ -36,6 +36,8 @@ module ActiveRecord
36
36
  end
37
37
 
38
38
  def rename_enum_value(name, existing_value, new_value)
39
+ raise "Renaming enum values is only supported in PostgreSQL 10.0+" unless rename_enum_value_supported?
40
+
39
41
  execute "ALTER TYPE #{name} RENAME VALUE '#{existing_value}' TO '#{new_value}'"
40
42
  end
41
43
 
@@ -48,6 +50,10 @@ module ActiveRecord
48
50
  spec[:enum_name] = column.cast_type.enum_name.inspect if column.type == :enum
49
51
  spec
50
52
  end
53
+
54
+ def rename_enum_value_supported?
55
+ ActiveRecord::Base.connection.send(:postgresql_version) >= 100_000
56
+ end
51
57
  end
52
58
  end
53
59
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module PostgresEnum
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  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: 0.3.0
4
+ version: 0.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: 2018-12-27 00:00:00.000000000 Z
11
+ date: 2019-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.2.0
20
- - - "<="
21
- - !ruby/object:Gem::Version
22
- version: '5.2'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,23 +24,20 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 4.2.0
30
- - - "<="
31
- - !ruby/object:Gem::Version
32
- version: '5.2'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: pg
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "<"
31
+ - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: '1'
33
+ version: '0'
40
34
  type: :runtime
41
35
  prerelease: false
42
36
  version_requirements: !ruby/object:Gem::Requirement
43
37
  requirements:
44
- - - "<"
38
+ - - ">="
45
39
  - !ruby/object:Gem::Version
46
- version: '1'
40
+ version: '0'
47
41
  - !ruby/object:Gem::Dependency
48
42
  name: appraisal
49
43
  requirement: !ruby/object:Gem::Requirement
@@ -62,14 +56,14 @@ dependencies:
62
56
  name: bundler
63
57
  requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
- - - "~>"
59
+ - - ">="
66
60
  - !ruby/object:Gem::Version
67
61
  version: '1.16'
68
62
  type: :development
69
63
  prerelease: false
70
64
  version_requirements: !ruby/object:Gem::Requirement
71
65
  requirements:
72
- - - "~>"
66
+ - - ">="
73
67
  - !ruby/object:Gem::Version
74
68
  version: '1.16'
75
69
  - !ruby/object:Gem::Dependency