schema_plus_enums 0.1.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/prs.yml +178 -0
- data/.gitignore +1 -0
- data/.simplecov +20 -0
- data/Gemfile +4 -1
- data/README.md +42 -30
- data/Rakefile +2 -0
- data/gemfiles/Gemfile.base +1 -1
- data/gemfiles/activerecord-5.2/Gemfile.base +2 -1
- data/gemfiles/activerecord-5.2/Gemfile.postgresql +2 -2
- data/gemfiles/activerecord-6.0/Gemfile.base +4 -0
- data/gemfiles/activerecord-6.0/Gemfile.postgresql +10 -0
- data/lib/schema_plus/enums/active_record.rb +75 -13
- data/lib/schema_plus/enums/middleware.rb +3 -1
- data/lib/schema_plus/enums/version.rb +3 -1
- data/lib/schema_plus/enums.rb +2 -1
- data/lib/schema_plus_enums.rb +2 -0
- data/schema_dev.yml +6 -6
- data/schema_plus_enums.gemspec +10 -10
- data/spec/enum_spec.rb +227 -8
- data/spec/schema_dumper_spec.rb +2 -0
- data/spec/spec_helper.rb +25 -4
- metadata +25 -71
- data/.travis.yml +0 -21
- data/gemfiles/activerecord-4.2/Gemfile.base +0 -3
- data/gemfiles/activerecord-4.2/Gemfile.postgresql +0 -10
- data/gemfiles/activerecord-5.0/Gemfile.base +0 -3
- data/gemfiles/activerecord-5.0/Gemfile.postgresql +0 -10
- data/gemfiles/activerecord-5.1/Gemfile.base +0 -3
- data/gemfiles/activerecord-5.1/Gemfile.postgresql +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6b529b06d1cc7b79298595971ba6d8e1f4dc301974b27250017a51cf161bb36
|
4
|
+
data.tar.gz: caa6540979727f313d75fd7dfd8da82aede46579d45c99ee57804663c26bff32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ceb96e6b73c848ed8e2e900d431f27b893db3b083551b7db11764e7465cdfe74426c5895fe5131060480d98b25a16bc9feeb57fb7532a6709d038fe335de920
|
7
|
+
data.tar.gz: 0f7a2d7b5fe615523c22f91f50d53ae410d87156e4bcc2f8ec4d87ca2f7bf24e3b4cb27d358a786dfacda4681a23fa69030f5c449034a4ac94a49cadc3f848c4
|
@@ -0,0 +1,178 @@
|
|
1
|
+
# This file was auto-generated by the schema_dev tool, based on the data in
|
2
|
+
# ./schema_dev.yml
|
3
|
+
# Please do not edit this file; any changes will be overwritten next time
|
4
|
+
# schema_dev gets run.
|
5
|
+
---
|
6
|
+
name: CI PR Builds
|
7
|
+
'on':
|
8
|
+
push:
|
9
|
+
branches:
|
10
|
+
- master
|
11
|
+
pull_request:
|
12
|
+
concurrency:
|
13
|
+
group: ci-${{ github.ref }}
|
14
|
+
cancel-in-progress: true
|
15
|
+
jobs:
|
16
|
+
test:
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
ruby:
|
22
|
+
- '2.5'
|
23
|
+
- '2.7'
|
24
|
+
- '3.0'
|
25
|
+
activerecord:
|
26
|
+
- '5.2'
|
27
|
+
- '6.0'
|
28
|
+
db:
|
29
|
+
- skip
|
30
|
+
dbversion:
|
31
|
+
- skip
|
32
|
+
exclude:
|
33
|
+
- ruby: '3.0'
|
34
|
+
activerecord: '5.2'
|
35
|
+
- db: skip
|
36
|
+
dbversion: skip
|
37
|
+
include:
|
38
|
+
- ruby: '2.5'
|
39
|
+
activerecord: '5.2'
|
40
|
+
db: postgresql
|
41
|
+
dbversion: '9.6'
|
42
|
+
- ruby: '2.5'
|
43
|
+
activerecord: '5.2'
|
44
|
+
db: postgresql
|
45
|
+
dbversion: '10'
|
46
|
+
- ruby: '2.5'
|
47
|
+
activerecord: '5.2'
|
48
|
+
db: postgresql
|
49
|
+
dbversion: '11'
|
50
|
+
- ruby: '2.5'
|
51
|
+
activerecord: '5.2'
|
52
|
+
db: postgresql
|
53
|
+
dbversion: '12'
|
54
|
+
- ruby: '2.5'
|
55
|
+
activerecord: '6.0'
|
56
|
+
db: postgresql
|
57
|
+
dbversion: '9.6'
|
58
|
+
- ruby: '2.5'
|
59
|
+
activerecord: '6.0'
|
60
|
+
db: postgresql
|
61
|
+
dbversion: '10'
|
62
|
+
- ruby: '2.5'
|
63
|
+
activerecord: '6.0'
|
64
|
+
db: postgresql
|
65
|
+
dbversion: '11'
|
66
|
+
- ruby: '2.5'
|
67
|
+
activerecord: '6.0'
|
68
|
+
db: postgresql
|
69
|
+
dbversion: '12'
|
70
|
+
- ruby: '2.7'
|
71
|
+
activerecord: '5.2'
|
72
|
+
db: postgresql
|
73
|
+
dbversion: '9.6'
|
74
|
+
- ruby: '2.7'
|
75
|
+
activerecord: '5.2'
|
76
|
+
db: postgresql
|
77
|
+
dbversion: '10'
|
78
|
+
- ruby: '2.7'
|
79
|
+
activerecord: '5.2'
|
80
|
+
db: postgresql
|
81
|
+
dbversion: '11'
|
82
|
+
- ruby: '2.7'
|
83
|
+
activerecord: '5.2'
|
84
|
+
db: postgresql
|
85
|
+
dbversion: '12'
|
86
|
+
- ruby: '2.7'
|
87
|
+
activerecord: '6.0'
|
88
|
+
db: postgresql
|
89
|
+
dbversion: '9.6'
|
90
|
+
- ruby: '2.7'
|
91
|
+
activerecord: '6.0'
|
92
|
+
db: postgresql
|
93
|
+
dbversion: '10'
|
94
|
+
- ruby: '2.7'
|
95
|
+
activerecord: '6.0'
|
96
|
+
db: postgresql
|
97
|
+
dbversion: '11'
|
98
|
+
- ruby: '2.7'
|
99
|
+
activerecord: '6.0'
|
100
|
+
db: postgresql
|
101
|
+
dbversion: '12'
|
102
|
+
- ruby: '3.0'
|
103
|
+
activerecord: '6.0'
|
104
|
+
db: postgresql
|
105
|
+
dbversion: '9.6'
|
106
|
+
- ruby: '3.0'
|
107
|
+
activerecord: '6.0'
|
108
|
+
db: postgresql
|
109
|
+
dbversion: '10'
|
110
|
+
- ruby: '3.0'
|
111
|
+
activerecord: '6.0'
|
112
|
+
db: postgresql
|
113
|
+
dbversion: '11'
|
114
|
+
- ruby: '3.0'
|
115
|
+
activerecord: '6.0'
|
116
|
+
db: postgresql
|
117
|
+
dbversion: '12'
|
118
|
+
env:
|
119
|
+
BUNDLE_GEMFILE: "${{ github.workspace }}/gemfiles/activerecord-${{ matrix.activerecord }}/Gemfile.${{ matrix.db }}"
|
120
|
+
POSTGRESQL_DB_HOST: 127.0.0.1
|
121
|
+
POSTGRESQL_DB_USER: schema_plus_test
|
122
|
+
POSTGRESQL_DB_PASS: database
|
123
|
+
steps:
|
124
|
+
- uses: actions/checkout@v2
|
125
|
+
- name: Set up Ruby
|
126
|
+
uses: ruby/setup-ruby@v1
|
127
|
+
with:
|
128
|
+
ruby-version: "${{ matrix.ruby }}"
|
129
|
+
bundler-cache: true
|
130
|
+
- name: Run bundle update
|
131
|
+
run: bundle update
|
132
|
+
- name: Start Postgresql
|
133
|
+
if: matrix.db == 'postgresql'
|
134
|
+
run: |
|
135
|
+
docker run --rm --detach \
|
136
|
+
-e POSTGRES_USER=$POSTGRESQL_DB_USER \
|
137
|
+
-e POSTGRES_PASSWORD=$POSTGRESQL_DB_PASS \
|
138
|
+
-p 5432:5432 \
|
139
|
+
--health-cmd "pg_isready -q" \
|
140
|
+
--health-interval 5s \
|
141
|
+
--health-timeout 5s \
|
142
|
+
--health-retries 5 \
|
143
|
+
--name database postgres:${{ matrix.dbversion }}
|
144
|
+
- name: Wait for database to start
|
145
|
+
if: "(matrix.db == 'postgresql' || matrix.db == 'mysql2')"
|
146
|
+
run: |
|
147
|
+
COUNT=0
|
148
|
+
ATTEMPTS=20
|
149
|
+
until [[ $COUNT -eq $ATTEMPTS ]]; do
|
150
|
+
[ "$(docker inspect -f {{.State.Health.Status}} database)" == "healthy" ] && break
|
151
|
+
echo $(( COUNT++ )) > /dev/null
|
152
|
+
sleep 2
|
153
|
+
done
|
154
|
+
- name: Create testing database
|
155
|
+
if: "(matrix.db == 'postgresql' || matrix.db == 'mysql2')"
|
156
|
+
run: bundle exec rake create_ci_database
|
157
|
+
- name: Run tests
|
158
|
+
run: bundle exec rake spec
|
159
|
+
- name: Shutdown database
|
160
|
+
if: always() && (matrix.db == 'postgresql' || matrix.db == 'mysql2')
|
161
|
+
run: docker stop database
|
162
|
+
- name: Coveralls Parallel
|
163
|
+
if: "${{ !env.ACT }}"
|
164
|
+
uses: coverallsapp/github-action@master
|
165
|
+
with:
|
166
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
167
|
+
flag-name: run-${{ matrix.ruby }}-${{ matrix.activerecord }}-${{ matrix.db }}-${{ matrix.dbversion }}
|
168
|
+
parallel: true
|
169
|
+
finish:
|
170
|
+
needs: test
|
171
|
+
runs-on: ubuntu-latest
|
172
|
+
steps:
|
173
|
+
- name: Coveralls Finished
|
174
|
+
if: "${{ !env.ACT }}"
|
175
|
+
uses: coverallsapp/github-action@master
|
176
|
+
with:
|
177
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
178
|
+
parallel-finished: true
|
data/.gitignore
CHANGED
data/.simplecov
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
SimpleCov.configure do
|
4
|
+
enable_coverage :branch
|
5
|
+
add_filter '/spec/'
|
6
|
+
|
7
|
+
add_group 'Binaries', '/bin/'
|
8
|
+
add_group 'Libraries', '/lib/'
|
9
|
+
|
10
|
+
if ENV['CI']
|
11
|
+
require 'simplecov-lcov'
|
12
|
+
|
13
|
+
SimpleCov::Formatter::LcovFormatter.config do |c|
|
14
|
+
c.report_with_single_file = true
|
15
|
+
c.single_report_path = 'coverage/lcov.info'
|
16
|
+
end
|
17
|
+
|
18
|
+
formatter SimpleCov::Formatter::LcovFormatter
|
19
|
+
end
|
20
|
+
end
|
data/Gemfile
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source "http://rubygems.org"
|
2
4
|
|
3
5
|
gemspec
|
4
6
|
|
5
|
-
|
7
|
+
gemfile_local = File.expand_path '../Gemfile.local', __FILE__
|
8
|
+
eval File.read(gemfile_local), binding, gemfile_local if File.exist? gemfile_local
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/schema_plus_enums.svg)](http://badge.fury.io/rb/schema_plus_enums)
|
2
|
-
[![Build Status](https://
|
3
|
-
[![Coverage Status](https://
|
2
|
+
[![Build Status](https://github.com/SchemaPlus/schema_plus_enums/actions/workflows/pr.yml/badge.svg)](http://github.com/SchemaPlus/schema_plus_enums/actions)
|
3
|
+
[![Coverage Status](https://coveralls.io/github/SchemaPlus/schema_plus_enums/badge.svg)](https://coveralls.io/github/SchemaPlus/schema_plus_enums)
|
4
4
|
|
5
5
|
# SchemaPlus::Enums
|
6
6
|
|
@@ -28,18 +28,11 @@ SchemaPlus::Enums is tested on:
|
|
28
28
|
|
29
29
|
<!-- SCHEMA_DEV: MATRIX - begin -->
|
30
30
|
<!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->
|
31
|
-
* ruby **2.
|
32
|
-
* ruby **2.
|
33
|
-
* ruby **2.
|
34
|
-
* ruby **2.
|
35
|
-
* ruby **
|
36
|
-
* ruby **2.3.4** with activerecord **5.0**, using **postgresql**
|
37
|
-
* ruby **2.3.4** with activerecord **5.1**, using **postgresql**
|
38
|
-
* ruby **2.3.4** with activerecord **5.2**, using **postgresql**
|
39
|
-
* ruby **2.4.1** with activerecord **4.2**, using **postgresql**
|
40
|
-
* ruby **2.4.1** with activerecord **5.0**, using **postgresql**
|
41
|
-
* ruby **2.4.1** with activerecord **5.1**, using **postgresql**
|
42
|
-
* ruby **2.4.1** with activerecord **5.2**, using **postgresql**
|
31
|
+
* ruby **2.5** with activerecord **5.2**, using **postgresql:9.6**, **postgresql:10**, **postgresql:11** or **postgresql:12**
|
32
|
+
* ruby **2.5** with activerecord **6.0**, using **postgresql:9.6**, **postgresql:10**, **postgresql:11** or **postgresql:12**
|
33
|
+
* ruby **2.7** with activerecord **5.2**, using **postgresql:9.6**, **postgresql:10**, **postgresql:11** or **postgresql:12**
|
34
|
+
* ruby **2.7** with activerecord **6.0**, using **postgresql:9.6**, **postgresql:10**, **postgresql:11** or **postgresql:12**
|
35
|
+
* ruby **3.0** with activerecord **6.0**, using **postgresql:9.6**, **postgresql:10**, **postgresql:11** or **postgresql:12**
|
43
36
|
|
44
37
|
<!-- SCHEMA_DEV: MATRIX - end -->
|
45
38
|
|
@@ -53,13 +46,32 @@ create_enum :color, 'red', 'green', 'blue' # default schema is 'public'
|
|
53
46
|
create_enum :color, 'cyan', 'magenta', 'yellow', 'black', schema: 'cmyk'
|
54
47
|
```
|
55
48
|
|
56
|
-
|
49
|
+
New values can be added
|
57
50
|
|
58
51
|
```ruby
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
52
|
+
add_enum_value :color, 'black'
|
53
|
+
add_enum_value :color, 'red', if_not_exists: true
|
54
|
+
add_enum_value :color, 'purple', after: 'red'
|
55
|
+
add_enum_value :color, 'pink', before: 'purple'
|
56
|
+
add_enum_value :color, 'white', schema: 'cmyk'
|
57
|
+
```
|
58
|
+
|
59
|
+
Values can be dropped
|
60
|
+
```ruby
|
61
|
+
remove_enum_value :color, 'black'
|
62
|
+
remove_enum_value :color, 'black', schema: 'cmyk'
|
63
|
+
```
|
64
|
+
|
65
|
+
Values can be renamed
|
66
|
+
```ruby
|
67
|
+
rename_enum_value :color, 'red', 'orange'
|
68
|
+
rename_enum_value :color, 'red', 'orange', schema: 'cmyk'
|
69
|
+
```
|
70
|
+
|
71
|
+
The enum can be renamed
|
72
|
+
```ruby
|
73
|
+
rename_enum :color, :hue
|
74
|
+
rename_enum :color, :hue, schema: 'cmyk'
|
63
75
|
```
|
64
76
|
|
65
77
|
And can be dropped:
|
@@ -71,15 +83,16 @@ drop_enum :color, schema: 'cmyk'
|
|
71
83
|
|
72
84
|
## Release Notes
|
73
85
|
|
74
|
-
* 0.
|
75
|
-
* 0.1.
|
76
|
-
* 0.1.
|
77
|
-
* 0.1.
|
78
|
-
* 0.1.
|
79
|
-
* 0.1.
|
80
|
-
* 0.1.
|
81
|
-
* 0.1.
|
82
|
-
* 0.1.
|
86
|
+
* **1.0.0** - Add AR 6.0, Ruby 3.0, and drop AR < 5.2 and Ruby < 2.5. Also add new functionality
|
87
|
+
* **0.1.8** - Update dependencies to include AR 5.2.
|
88
|
+
* **0.1.7** - Update dependencies to include AR 5.1.* Thanks to [@patleb](https://github.com/patleb)
|
89
|
+
* **0.1.6** - Update dependencies to include AR 5.1. Thanks to [@willsoto](https://github.com/willsoto)
|
90
|
+
* **0.1.5** - Update dependencies to include AR 5.0. Thanks to [@jimcavoli](https://github.com/jimcavoli)
|
91
|
+
* **0.1.4** - Missing require
|
92
|
+
* **0.1.3** - Explicit gem dependencies
|
93
|
+
* **0.1.2** - Upgrade schema_plus_core dependency
|
94
|
+
* **0.1.1** - Clean up and sort dumper output. Thanks to [@pik](https://github.com/pik)
|
95
|
+
* **0.1.0** - Initial release, pulled from schema_plus 1.x
|
83
96
|
|
84
97
|
## Development & Testing
|
85
98
|
|
@@ -94,7 +107,7 @@ Some things to know about to help you develop and test:
|
|
94
107
|
* **schema_dev**: SchemaPlus::Enums uses [schema_dev](https://github.com/SchemaPlus/schema_dev) to
|
95
108
|
facilitate running rspec tests on the matrix of ruby, activerecord, and database
|
96
109
|
versions that the gem supports, both locally and on
|
97
|
-
[
|
110
|
+
[github actions](https://github.com/SchemaPlus/schema_plus_enums/actions)
|
98
111
|
|
99
112
|
To to run rspec locally on the full matrix, do:
|
100
113
|
|
@@ -106,7 +119,6 @@ Some things to know about to help you develop and test:
|
|
106
119
|
The matrix of configurations is specified in `schema_dev.yml` in
|
107
120
|
the project root.
|
108
121
|
|
109
|
-
|
110
122
|
<!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - end -->
|
111
123
|
|
112
124
|
<!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_PLUS_CORE - begin -->
|
data/Rakefile
CHANGED
data/gemfiles/Gemfile.base
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SchemaPlus::Enums
|
2
4
|
module ActiveRecord
|
3
5
|
module ConnectionAdapters
|
@@ -28,30 +30,93 @@ module SchemaPlus::Enums
|
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
31
|
-
def create_enum(name, *values)
|
32
|
-
options = values.extract_options!
|
33
|
+
def create_enum(name, *values, **options)
|
33
34
|
list = values.map { |value| escape_enum_value(value) }
|
35
|
+
|
36
|
+
if options[:force]
|
37
|
+
drop_enum(name,
|
38
|
+
cascade: options[:force] == :cascade,
|
39
|
+
if_exists: true,
|
40
|
+
schema: options[:schema])
|
41
|
+
end
|
42
|
+
|
34
43
|
execute "CREATE TYPE #{enum_name(name, options[:schema])} AS ENUM (#{list.join(',')})"
|
35
44
|
end
|
36
45
|
|
37
|
-
def alter_enum(name, value, options
|
38
|
-
|
39
|
-
|
40
|
-
|
46
|
+
def alter_enum(name, value, **options)
|
47
|
+
ActiveSupport::Deprecation.warn "alter_enum is deprecated. use add_enum_value instead"
|
48
|
+
|
49
|
+
add_enum_value(name, value, **options)
|
50
|
+
end
|
51
|
+
|
52
|
+
def add_enum_value(name, value, **options)
|
53
|
+
sql = +"ALTER TYPE #{enum_name(name, options[:schema])} ADD VALUE "
|
54
|
+
sql << 'IF NOT EXISTS ' if options[:if_not_exists]
|
55
|
+
sql << escape_enum_value(value)
|
56
|
+
sql << case
|
57
|
+
when options[:before] then " BEFORE #{escape_enum_value(options[:before])}"
|
58
|
+
when options[:after] then " AFTER #{escape_enum_value(options[:after])}"
|
41
59
|
else
|
42
60
|
''
|
43
61
|
end
|
44
|
-
execute
|
62
|
+
execute sql
|
63
|
+
end
|
64
|
+
|
65
|
+
def remove_enum_value(name, value, **options)
|
66
|
+
sql = <<~SQL
|
67
|
+
DELETE FROM pg_enum
|
68
|
+
WHERE enumlabel=#{escape_enum_value(value)}
|
69
|
+
AND enumtypid = (
|
70
|
+
SELECT T.oid
|
71
|
+
FROM pg_type T
|
72
|
+
JOIN pg_namespace N ON N.oid = T.typnamespace
|
73
|
+
WHERE T.typname = #{quote name} AND N.nspname = #{quote schema_name(options[:schema])}
|
74
|
+
)
|
75
|
+
SQL
|
76
|
+
execute sql
|
77
|
+
end
|
78
|
+
|
79
|
+
def rename_enum_value(name, value, new_value, **options)
|
80
|
+
raise "Renaming enum values is only supported in PostgreSQL 10.0+" unless rename_enum_value_supported?
|
81
|
+
|
82
|
+
sql = <<~SQL
|
83
|
+
ALTER TYPE #{enum_name(name, options[:schema])}
|
84
|
+
RENAME VALUE #{escape_enum_value(value)}
|
85
|
+
TO #{escape_enum_value(new_value)}
|
86
|
+
SQL
|
87
|
+
|
88
|
+
execute sql
|
45
89
|
end
|
46
90
|
|
47
|
-
def
|
48
|
-
execute "
|
91
|
+
def rename_enum(name, new_name, **options)
|
92
|
+
execute "ALTER TYPE #{enum_name(name, options[:schema])} RENAME TO #{new_name}"
|
93
|
+
end
|
94
|
+
|
95
|
+
def drop_enum(name, **options)
|
96
|
+
sql = +'DROP TYPE '
|
97
|
+
sql << 'IF EXISTS ' if options[:if_exists]
|
98
|
+
sql << enum_name(name, options[:schema])
|
99
|
+
sql << ' CASCADE' if options[:cascade]
|
100
|
+
|
101
|
+
execute sql
|
49
102
|
end
|
50
103
|
|
51
104
|
private
|
52
105
|
|
106
|
+
def rename_enum_value_supported?
|
107
|
+
unless defined? @rename_enum_value_supported
|
108
|
+
version = select_value("SHOW server_version").match(/(\d+\.\d+)/)[1]
|
109
|
+
@rename_enum_value_supported = Gem::Version.new(version) >= Gem::Version.new('10.0')
|
110
|
+
end
|
111
|
+
@rename_enum_value_supported
|
112
|
+
end
|
113
|
+
|
114
|
+
def schema_name(schema)
|
115
|
+
schema || 'public'
|
116
|
+
end
|
117
|
+
|
53
118
|
def enum_name(name, schema)
|
54
|
-
[schema
|
119
|
+
[schema_name(schema), name].map { |s|
|
55
120
|
%Q{"#{s}"}
|
56
121
|
}.join('.')
|
57
122
|
end
|
@@ -60,10 +125,7 @@ module SchemaPlus::Enums
|
|
60
125
|
escaped_value = value.to_s.sub("'", "''")
|
61
126
|
"'#{escaped_value}'"
|
62
127
|
end
|
63
|
-
|
64
|
-
|
65
128
|
end
|
66
129
|
end
|
67
130
|
end
|
68
131
|
end
|
69
|
-
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module SchemaPlus::Enums
|
2
4
|
module Middleware
|
3
5
|
|
@@ -7,7 +9,7 @@ module SchemaPlus::Enums
|
|
7
9
|
module Postgresql
|
8
10
|
|
9
11
|
def after(env)
|
10
|
-
env.connection.enums.sort_by
|
12
|
+
env.connection.enums.sort_by { |it| it[1] }.each do |schema, name, values|
|
11
13
|
params = [name.inspect]
|
12
14
|
params << values.map(&:inspect).join(', ')
|
13
15
|
params << ":schema => #{schema.inspect}" if schema != 'public'
|
data/lib/schema_plus/enums.rb
CHANGED
data/lib/schema_plus_enums.rb
CHANGED
data/schema_dev.yml
CHANGED
data/schema_plus_enums.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'schema_plus/enums/version'
|
@@ -18,14 +19,13 @@ Gem::Specification.new do |gem|
|
|
18
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
20
|
gem.require_paths = ["lib"]
|
20
21
|
|
21
|
-
gem.
|
22
|
-
|
23
|
-
gem.add_dependency
|
22
|
+
gem.required_ruby_version = '>= 2.5'
|
23
|
+
|
24
|
+
gem.add_dependency 'activerecord', '>= 5.2', '< 6.1'
|
25
|
+
gem.add_dependency 'schema_plus_core', '~> 3.0.0'
|
24
26
|
|
25
|
-
gem.add_development_dependency
|
26
|
-
gem.add_development_dependency
|
27
|
-
gem.add_development_dependency
|
28
|
-
gem.add_development_dependency
|
29
|
-
gem.add_development_dependency "simplecov"
|
30
|
-
gem.add_development_dependency "simplecov-gem-profile"
|
27
|
+
gem.add_development_dependency 'bundler'
|
28
|
+
gem.add_development_dependency 'rake', '~> 13.0'
|
29
|
+
gem.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
gem.add_development_dependency 'schema_dev', '~> 4.1'
|
31
31
|
end
|
data/spec/enum_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
def enum_fields(name, schema = 'public')
|
@@ -16,7 +18,9 @@ def enum_fields(name, schema = 'public')
|
|
16
18
|
end
|
17
19
|
|
18
20
|
describe 'enum', :postgresql => :only do
|
19
|
-
before(:all) do
|
21
|
+
before(:all) do
|
22
|
+
ActiveRecord::Migration.verbose = false
|
23
|
+
end
|
20
24
|
|
21
25
|
let(:migration) { ActiveRecord::Migration }
|
22
26
|
|
@@ -73,7 +77,7 @@ describe 'enum', :postgresql => :only do
|
|
73
77
|
end
|
74
78
|
end
|
75
79
|
|
76
|
-
it 'should escape
|
80
|
+
it 'should escape scheme name and enum name' do
|
77
81
|
begin
|
78
82
|
migration.execute 'CREATE SCHEMA "select"'
|
79
83
|
migration.create_enum 'where', *%|red green blue|, schema: 'select'
|
@@ -83,24 +87,92 @@ describe 'enum', :postgresql => :only do
|
|
83
87
|
end
|
84
88
|
end
|
85
89
|
|
90
|
+
context 'when force: true is passed' do
|
91
|
+
it 'removes the existing enum' do
|
92
|
+
allow(migration.connection).to receive(:drop_enum)
|
93
|
+
|
94
|
+
migration.create_enum 'color', *%w|red green blue|, force: true
|
95
|
+
|
96
|
+
expect(migration.connection).to have_received(:drop_enum).with(
|
97
|
+
'color', { cascade: false, if_exists: true, schema: nil }
|
98
|
+
)
|
99
|
+
|
100
|
+
migration.execute 'DROP TYPE IF EXISTS color'
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'when force: :cascade is passed' do
|
105
|
+
it 'removes the existing enum' do
|
106
|
+
allow(migration.connection).to receive(:drop_enum)
|
107
|
+
|
108
|
+
migration.create_enum 'color', *%w|red green blue|, force: :cascade
|
109
|
+
|
110
|
+
expect(migration.connection).to have_received(:drop_enum).with(
|
111
|
+
'color', { cascade: true, if_exists: true, schema: nil }
|
112
|
+
)
|
113
|
+
|
114
|
+
migration.execute 'DROP TYPE IF EXISTS color'
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context 'when force: :cascade is passed with a schema' do
|
119
|
+
it 'removes the existing enum' do
|
120
|
+
allow(migration.connection).to receive(:drop_enum)
|
121
|
+
|
122
|
+
migration.create_enum 'color', *%w|red green blue|, force: :cascade, schema: 'public'
|
123
|
+
|
124
|
+
expect(migration.connection).to have_received(:drop_enum).with(
|
125
|
+
'color', { cascade: true, if_exists: true, schema: 'public' }
|
126
|
+
)
|
127
|
+
|
128
|
+
migration.execute 'DROP TYPE IF EXISTS color'
|
129
|
+
end
|
130
|
+
end
|
86
131
|
end
|
87
132
|
|
88
133
|
describe 'alter_enum' do
|
89
|
-
before
|
90
|
-
|
134
|
+
before do
|
135
|
+
migration.create_enum('color', 'red', 'green', 'blue')
|
136
|
+
allow(ActiveSupport::Deprecation).to receive(:warn)
|
137
|
+
allow(migration.connection).to receive(:add_enum_value)
|
138
|
+
end
|
139
|
+
after do
|
140
|
+
migration.execute 'DROP TYPE IF EXISTS color'
|
141
|
+
end
|
91
142
|
|
92
|
-
it '
|
143
|
+
it 'calls add_enum_value' do
|
144
|
+
migration.alter_enum('color', 'magenta')
|
145
|
+
|
146
|
+
expect(migration.connection).to have_received(:add_enum_value)
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'sends a deprecation warning' do
|
93
150
|
migration.alter_enum('color', 'magenta')
|
151
|
+
|
152
|
+
expect(ActiveSupport::Deprecation).to have_received(:warn)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe 'add_enum_value' do
|
157
|
+
before do
|
158
|
+
migration.create_enum('color', 'red', 'green', 'blue')
|
159
|
+
end
|
160
|
+
after do
|
161
|
+
migration.execute 'DROP TYPE IF EXISTS color'
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'should add new value after all values' do
|
165
|
+
migration.add_enum_value('color', 'magenta')
|
94
166
|
expect(enum_fields('color')).to eq(%w|red green blue magenta|)
|
95
167
|
end
|
96
168
|
|
97
169
|
it 'should add new value after existed' do
|
98
|
-
migration.
|
170
|
+
migration.add_enum_value('color', 'magenta', after: 'red')
|
99
171
|
expect(enum_fields('color')).to eq(%w|red magenta green blue|)
|
100
172
|
end
|
101
173
|
|
102
174
|
it 'should add new value before existed' do
|
103
|
-
migration.
|
175
|
+
migration.add_enum_value('color', 'magenta', before: 'green')
|
104
176
|
expect(enum_fields('color')).to eq(%w|red magenta green blue|)
|
105
177
|
end
|
106
178
|
|
@@ -108,13 +180,125 @@ describe 'enum', :postgresql => :only do
|
|
108
180
|
begin
|
109
181
|
migration.execute 'CREATE SCHEMA colors'
|
110
182
|
migration.create_enum('color', 'red', schema: 'colors')
|
111
|
-
migration.
|
183
|
+
migration.add_enum_value('color', 'green', schema: 'colors')
|
112
184
|
|
113
185
|
expect(enum_fields('color', 'colors')).to eq(%w|red green|)
|
114
186
|
ensure
|
115
187
|
migration.execute 'DROP SCHEMA colors CASCADE'
|
116
188
|
end
|
117
189
|
end
|
190
|
+
|
191
|
+
context 'without if_not_exists: true' do
|
192
|
+
it 'raises a DB error if the value exists' do
|
193
|
+
expect {
|
194
|
+
migration.add_enum_value('color', 'red')
|
195
|
+
}.to raise_error(ActiveRecord::StatementInvalid)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
context 'with if_not_exists: true' do
|
200
|
+
it 'does not raise a DB error if the value exists' do
|
201
|
+
expect {
|
202
|
+
migration.add_enum_value('color', 'red', if_not_exists: true)
|
203
|
+
}.to_not raise_error
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
describe 'remove_enum_value' do
|
209
|
+
before do
|
210
|
+
migration.create_enum('color', 'red', 'green', 'blue')
|
211
|
+
end
|
212
|
+
after do
|
213
|
+
migration.execute 'DROP TYPE IF EXISTS color'
|
214
|
+
end
|
215
|
+
|
216
|
+
it 'removes the value' do
|
217
|
+
expect {
|
218
|
+
migration.remove_enum_value('color', 'green')
|
219
|
+
}.to change {
|
220
|
+
enum_fields('color')
|
221
|
+
}.to(%w[red blue])
|
222
|
+
end
|
223
|
+
|
224
|
+
context 'when the enum is in a schema' do
|
225
|
+
before do
|
226
|
+
migration.execute "CREATE SCHEMA colors; CREATE TYPE colors.color AS ENUM ('red', 'magenta', 'blue')"
|
227
|
+
end
|
228
|
+
after do
|
229
|
+
migration.execute "DROP SCHEMA colors CASCADE"
|
230
|
+
end
|
231
|
+
|
232
|
+
it 'should rename the enum within given name and schema' do
|
233
|
+
expect {
|
234
|
+
migration.remove_enum_value('color', 'blue', schema: 'colors')
|
235
|
+
}.to change {
|
236
|
+
enum_fields('color', 'colors')
|
237
|
+
}.to(%w[red magenta])
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
describe 'rename_enum_value' do
|
243
|
+
before do
|
244
|
+
migration.create_enum('color', 'red', 'green', 'blue')
|
245
|
+
end
|
246
|
+
after do
|
247
|
+
migration.execute 'DROP TYPE IF EXISTS color'
|
248
|
+
end
|
249
|
+
|
250
|
+
context 'when postgresql version is >= 10', pg_version: '>= 10.0' do
|
251
|
+
it 'renames the value' do
|
252
|
+
expect {
|
253
|
+
migration.rename_enum_value('color', 'green', 'orange')
|
254
|
+
}.to change {
|
255
|
+
enum_fields('color')
|
256
|
+
}.to(%w[red orange blue])
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
context 'when postgresql version is < 10', pg_version: '< 10.0' do
|
261
|
+
it 'raises an error' do
|
262
|
+
expect {
|
263
|
+
migration.rename_enum_value('color', 'green', 'orange')
|
264
|
+
}.to raise_error(/Renaming enum values is only supported/)
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
describe 'rename_enum' do
|
270
|
+
before do
|
271
|
+
migration.create_enum('color', 'red', 'green', 'blue')
|
272
|
+
end
|
273
|
+
after do
|
274
|
+
migration.execute 'DROP TYPE IF EXISTS color'
|
275
|
+
migration.execute 'DROP TYPE IF EXISTS shade'
|
276
|
+
end
|
277
|
+
|
278
|
+
it 'renames the enum' do
|
279
|
+
expect {
|
280
|
+
migration.rename_enum('color', 'shade')
|
281
|
+
}.to change {
|
282
|
+
migration.enums.map(&:second)
|
283
|
+
}.from(contain_exactly('color')).to(contain_exactly('shade'))
|
284
|
+
end
|
285
|
+
|
286
|
+
context 'when the enum is in a schema' do
|
287
|
+
before do
|
288
|
+
migration.execute "CREATE SCHEMA colors; CREATE TYPE colors.color AS ENUM ('red', 'blue')"
|
289
|
+
end
|
290
|
+
after do
|
291
|
+
migration.execute "DROP SCHEMA colors CASCADE"
|
292
|
+
end
|
293
|
+
|
294
|
+
it 'should rename the enum within given name and schema' do
|
295
|
+
expect {
|
296
|
+
migration.rename_enum('color', 'shade', schema: 'colors')
|
297
|
+
}.to change {
|
298
|
+
enum_fields('shade', 'colors')
|
299
|
+
}.from(nil).to(%w[red blue])
|
300
|
+
end
|
301
|
+
end
|
118
302
|
end
|
119
303
|
|
120
304
|
describe 'drop_enum' do
|
@@ -137,5 +321,40 @@ describe 'enum', :postgresql => :only do
|
|
137
321
|
migration.execute "DROP SCHEMA colors CASCADE"
|
138
322
|
end
|
139
323
|
end
|
324
|
+
|
325
|
+
context 'when the enum does not exist' do
|
326
|
+
it 'should fail when if_exists: true is not passed' do
|
327
|
+
expect {
|
328
|
+
migration.drop_enum('color')
|
329
|
+
}.to raise_error(ActiveRecord::StatementInvalid)
|
330
|
+
end
|
331
|
+
|
332
|
+
it 'should fail silently when if_exists: true is passed' do
|
333
|
+
expect {
|
334
|
+
migration.drop_enum('color', if_exists: true)
|
335
|
+
}.to_not raise_error
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
context 'when cascade: true is passed' do
|
340
|
+
it 'cascades through and drops columns' do
|
341
|
+
migration.create_enum 'color', %w[red blue green]
|
342
|
+
migration.create_table :posts do |t|
|
343
|
+
t.column :text_color, :color
|
344
|
+
end
|
345
|
+
|
346
|
+
expect {
|
347
|
+
migration.drop_enum 'color', cascade: true
|
348
|
+
}.to change {
|
349
|
+
migration.columns('posts').map(&:name)
|
350
|
+
}.from(include('text_color')).to not_include('text_color')
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
describe 'create_table' do
|
356
|
+
before do
|
357
|
+
migration.create_enum 'color', *%w|red green blue|, force: true
|
358
|
+
end
|
140
359
|
end
|
141
360
|
end
|
data/spec/schema_dumper_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'simplecov'
|
2
|
-
|
3
|
-
SimpleCov.start "gem"
|
4
|
+
SimpleCov.start
|
4
5
|
|
5
6
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
7
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
@@ -12,11 +13,31 @@ require 'schema_dev/rspec'
|
|
12
13
|
|
13
14
|
SchemaDev::Rspec.setup
|
14
15
|
|
15
|
-
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
|
16
|
+
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |f| require f }
|
17
|
+
|
18
|
+
RSpec::Matchers.define_negated_matcher :not_include, :include
|
16
19
|
|
17
20
|
RSpec.configure do |config|
|
18
21
|
config.warnings = true
|
22
|
+
|
23
|
+
config.filter_run_excluding pg_version: lambda { |v|
|
24
|
+
version = ActiveRecord::Base.connection.select_value("SHOW server_version").match(/(\d+\.\d+)/)[1]
|
25
|
+
postgresql_version = Gem::Version.new(version)
|
26
|
+
test = Gem::Requirement.new(v)
|
27
|
+
!test.satisfied_by?(postgresql_version)
|
28
|
+
}
|
29
|
+
|
30
|
+
config.after do
|
31
|
+
ActiveRecord::Base.connection.tap do |c|
|
32
|
+
c.enums.each do |p, e, _|
|
33
|
+
c.drop_enum e, schema: p, cascade: true
|
34
|
+
end
|
35
|
+
|
36
|
+
c.tables.each do |t|
|
37
|
+
c.drop_table t, cascade: true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
19
41
|
end
|
20
42
|
|
21
43
|
SimpleCov.command_name "[ruby #{RUBY_VERSION} - ActiveRecord #{::ActiveRecord::VERSION::STRING} - #{ActiveRecord::Base.connection.adapter_name}]"
|
22
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_plus_enums
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ronen barzel
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,76 +16,62 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '6.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '5.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '6.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: schema_plus_core
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '0'
|
40
|
-
type: :runtime
|
41
|
-
prerelease: false
|
42
|
-
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
requirements:
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: its-it
|
49
35
|
requirement: !ruby/object:Gem::Requirement
|
50
36
|
requirements:
|
51
37
|
- - "~>"
|
52
38
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
39
|
+
version: 3.0.0
|
54
40
|
type: :runtime
|
55
41
|
prerelease: false
|
56
42
|
version_requirements: !ruby/object:Gem::Requirement
|
57
43
|
requirements:
|
58
44
|
- - "~>"
|
59
45
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
46
|
+
version: 3.0.0
|
61
47
|
- !ruby/object:Gem::Dependency
|
62
48
|
name: bundler
|
63
49
|
requirement: !ruby/object:Gem::Requirement
|
64
50
|
requirements:
|
65
|
-
- - "
|
51
|
+
- - ">="
|
66
52
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
53
|
+
version: '0'
|
68
54
|
type: :development
|
69
55
|
prerelease: false
|
70
56
|
version_requirements: !ruby/object:Gem::Requirement
|
71
57
|
requirements:
|
72
|
-
- - "
|
58
|
+
- - ">="
|
73
59
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
60
|
+
version: '0'
|
75
61
|
- !ruby/object:Gem::Dependency
|
76
62
|
name: rake
|
77
63
|
requirement: !ruby/object:Gem::Requirement
|
78
64
|
requirements:
|
79
65
|
- - "~>"
|
80
66
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
67
|
+
version: '13.0'
|
82
68
|
type: :development
|
83
69
|
prerelease: false
|
84
70
|
version_requirements: !ruby/object:Gem::Requirement
|
85
71
|
requirements:
|
86
72
|
- - "~>"
|
87
73
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
74
|
+
version: '13.0'
|
89
75
|
- !ruby/object:Gem::Dependency
|
90
76
|
name: rspec
|
91
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,42 +92,14 @@ dependencies:
|
|
106
92
|
requirements:
|
107
93
|
- - "~>"
|
108
94
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
95
|
+
version: '4.1'
|
110
96
|
type: :development
|
111
97
|
prerelease: false
|
112
98
|
version_requirements: !ruby/object:Gem::Requirement
|
113
99
|
requirements:
|
114
100
|
- - "~>"
|
115
101
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
117
|
-
- !ruby/object:Gem::Dependency
|
118
|
-
name: simplecov
|
119
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - ">="
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '0'
|
124
|
-
type: :development
|
125
|
-
prerelease: false
|
126
|
-
version_requirements: !ruby/object:Gem::Requirement
|
127
|
-
requirements:
|
128
|
-
- - ">="
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: '0'
|
131
|
-
- !ruby/object:Gem::Dependency
|
132
|
-
name: simplecov-gem-profile
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - ">="
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '0'
|
138
|
-
type: :development
|
139
|
-
prerelease: false
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - ">="
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '0'
|
102
|
+
version: '4.1'
|
145
103
|
description: Adds support for enum data types in ActiveRecord
|
146
104
|
email:
|
147
105
|
- ronen@barzel.org
|
@@ -149,21 +107,18 @@ executables: []
|
|
149
107
|
extensions: []
|
150
108
|
extra_rdoc_files: []
|
151
109
|
files:
|
110
|
+
- ".github/workflows/prs.yml"
|
152
111
|
- ".gitignore"
|
153
|
-
- ".
|
112
|
+
- ".simplecov"
|
154
113
|
- Gemfile
|
155
114
|
- LICENSE.txt
|
156
115
|
- README.md
|
157
116
|
- Rakefile
|
158
117
|
- gemfiles/Gemfile.base
|
159
|
-
- gemfiles/activerecord-4.2/Gemfile.base
|
160
|
-
- gemfiles/activerecord-4.2/Gemfile.postgresql
|
161
|
-
- gemfiles/activerecord-5.0/Gemfile.base
|
162
|
-
- gemfiles/activerecord-5.0/Gemfile.postgresql
|
163
|
-
- gemfiles/activerecord-5.1/Gemfile.base
|
164
|
-
- gemfiles/activerecord-5.1/Gemfile.postgresql
|
165
118
|
- gemfiles/activerecord-5.2/Gemfile.base
|
166
119
|
- gemfiles/activerecord-5.2/Gemfile.postgresql
|
120
|
+
- gemfiles/activerecord-6.0/Gemfile.base
|
121
|
+
- gemfiles/activerecord-6.0/Gemfile.postgresql
|
167
122
|
- lib/schema_plus/enums.rb
|
168
123
|
- lib/schema_plus/enums/active_record.rb
|
169
124
|
- lib/schema_plus/enums/middleware.rb
|
@@ -178,7 +133,7 @@ homepage: https://github.com/SchemaPlus/schema_plus_enums
|
|
178
133
|
licenses:
|
179
134
|
- MIT
|
180
135
|
metadata: {}
|
181
|
-
post_install_message:
|
136
|
+
post_install_message:
|
182
137
|
rdoc_options: []
|
183
138
|
require_paths:
|
184
139
|
- lib
|
@@ -186,16 +141,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
186
141
|
requirements:
|
187
142
|
- - ">="
|
188
143
|
- !ruby/object:Gem::Version
|
189
|
-
version: '
|
144
|
+
version: '2.5'
|
190
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
146
|
requirements:
|
192
147
|
- - ">="
|
193
148
|
- !ruby/object:Gem::Version
|
194
149
|
version: '0'
|
195
150
|
requirements: []
|
196
|
-
|
197
|
-
|
198
|
-
signing_key:
|
151
|
+
rubygems_version: 3.0.8
|
152
|
+
signing_key:
|
199
153
|
specification_version: 4
|
200
154
|
summary: Adds support for enum data types in ActiveRecord
|
201
155
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# This file was auto-generated by the schema_dev tool, based on the data in
|
2
|
-
# ./schema_dev.yml
|
3
|
-
# Please do not edit this file; any changes will be overwritten next time
|
4
|
-
# schema_dev gets run.
|
5
|
-
---
|
6
|
-
sudo: false
|
7
|
-
rvm:
|
8
|
-
- 2.2.7
|
9
|
-
- 2.3.4
|
10
|
-
- 2.4.1
|
11
|
-
gemfile:
|
12
|
-
- gemfiles/activerecord-4.2/Gemfile.postgresql
|
13
|
-
- gemfiles/activerecord-5.0/Gemfile.postgresql
|
14
|
-
- gemfiles/activerecord-5.1/Gemfile.postgresql
|
15
|
-
- gemfiles/activerecord-5.2/Gemfile.postgresql
|
16
|
-
env: POSTGRESQL_DB_USER=postgres
|
17
|
-
addons:
|
18
|
-
postgresql: '9.4'
|
19
|
-
before_script: bundle exec rake create_databases
|
20
|
-
after_script: bundle exec rake drop_databases
|
21
|
-
script: bundle exec rake travis
|