schema_plus_columns 0.3.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/prs.yml +173 -0
  3. data/.gitignore +1 -0
  4. data/.simplecov +20 -0
  5. data/Gemfile +4 -1
  6. data/README.md +24 -15
  7. data/Rakefile +2 -0
  8. data/gemfiles/Gemfile.base +1 -1
  9. data/gemfiles/activerecord-5.2/Gemfile.base +2 -1
  10. data/gemfiles/activerecord-5.2/Gemfile.mysql2 +2 -2
  11. data/gemfiles/activerecord-5.2/Gemfile.postgresql +2 -2
  12. data/gemfiles/activerecord-5.2/Gemfile.sqlite3 +3 -3
  13. data/gemfiles/activerecord-6.0/Gemfile.base +4 -0
  14. data/gemfiles/activerecord-6.0/Gemfile.mysql2 +10 -0
  15. data/gemfiles/activerecord-6.0/Gemfile.postgresql +10 -0
  16. data/gemfiles/{activerecord-4.2 → activerecord-6.0}/Gemfile.sqlite3 +3 -3
  17. data/gemfiles/activerecord-6.1/Gemfile.base +4 -0
  18. data/gemfiles/activerecord-6.1/Gemfile.mysql2 +10 -0
  19. data/gemfiles/activerecord-6.1/Gemfile.postgresql +10 -0
  20. data/gemfiles/{activerecord-5.1 → activerecord-6.1}/Gemfile.sqlite3 +3 -3
  21. data/gemfiles/activerecord-7.0/Gemfile.base +4 -0
  22. data/gemfiles/activerecord-7.0/Gemfile.mysql2 +10 -0
  23. data/gemfiles/activerecord-7.0/Gemfile.postgresql +10 -0
  24. data/gemfiles/{activerecord-5.0 → activerecord-7.0}/Gemfile.sqlite3 +3 -3
  25. data/lib/schema_plus/columns/active_record/connection_adapters/column.rb +7 -2
  26. data/lib/schema_plus/columns/middleware/model.rb +2 -0
  27. data/lib/schema_plus/columns/version.rb +3 -1
  28. data/lib/schema_plus/columns.rb +2 -1
  29. data/lib/schema_plus_columns.rb +2 -0
  30. data/schema_dev.yml +7 -4
  31. data/schema_plus_columns.gemspec +11 -11
  32. data/spec/column_spec.rb +17 -13
  33. data/spec/sanity_spec.rb +2 -0
  34. data/spec/spec_helper.rb +3 -3
  35. metadata +39 -81
  36. data/.travis.yml +0 -27
  37. data/gemfiles/activerecord-4.2/Gemfile.base +0 -3
  38. data/gemfiles/activerecord-4.2/Gemfile.mysql2 +0 -10
  39. data/gemfiles/activerecord-4.2/Gemfile.postgresql +0 -10
  40. data/gemfiles/activerecord-5.0/Gemfile.base +0 -3
  41. data/gemfiles/activerecord-5.0/Gemfile.mysql2 +0 -10
  42. data/gemfiles/activerecord-5.0/Gemfile.postgresql +0 -10
  43. data/gemfiles/activerecord-5.1/Gemfile.base +0 -3
  44. data/gemfiles/activerecord-5.1/Gemfile.mysql2 +0 -10
  45. data/gemfiles/activerecord-5.1/Gemfile.postgresql +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 07a9504723919b9b88cdc2eab3b8dd7e4e1997cb
4
- data.tar.gz: f9263d9ac8b0331ae58b18fd2bc6e7ff3bb1398b
2
+ SHA256:
3
+ metadata.gz: 066d16f85c4f7e68ed05a0cd822c28e24581fc279ae39f9e60254d4084996e00
4
+ data.tar.gz: c2b388cf9cfb9a6fe97b56103fe00dd56756431703601cb656ae243a6ea9c87d
5
5
  SHA512:
6
- metadata.gz: 826a752a4d6103caf2c733dd89696ed37c48f2d1d0d583b4d99f9903c9ce71367328efed010d6f86fb956f84b3d19fefd68fcb762ab5ed860a91fe8d0eb53e55
7
- data.tar.gz: 82bad345931446964f268bcbbad17082fbe63c90c9a71103c119b2d4769c027128c0fd469de1645577d7d3dfdf8739be45377b286a5e473f21762d650972ea0b
6
+ metadata.gz: 9011188949540e432f7f76c376d21bedc8063cba009121953df273137870309467c1f0d69f884a0144fca1da574f59d529d835b7223756fbea0d8b58cb55b66c
7
+ data.tar.gz: 2824f53d14c89e44a6f8af7cce2b568244973d23a2a3db21ac7c8a4ba0a76569450f60b2ce68e58e5e7698cc84480bb4ef5fa79337eb256cd504f103a1fa75c1
@@ -0,0 +1,173 @@
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
+ - '3.1'
26
+ activerecord:
27
+ - '5.2'
28
+ - '6.0'
29
+ - '6.1'
30
+ - '7.0'
31
+ db:
32
+ - mysql2
33
+ - sqlite3
34
+ - skip
35
+ dbversion:
36
+ - skip
37
+ exclude:
38
+ - ruby: '3.0'
39
+ activerecord: '5.2'
40
+ - ruby: '3.1'
41
+ activerecord: '5.2'
42
+ - ruby: '2.5'
43
+ activerecord: '7.0'
44
+ - db: skip
45
+ dbversion: skip
46
+ include:
47
+ - ruby: '2.5'
48
+ activerecord: '5.2'
49
+ db: postgresql
50
+ dbversion: '9.6'
51
+ - ruby: '2.5'
52
+ activerecord: '6.0'
53
+ db: postgresql
54
+ dbversion: '9.6'
55
+ - ruby: '2.5'
56
+ activerecord: '6.1'
57
+ db: postgresql
58
+ dbversion: '9.6'
59
+ - ruby: '2.7'
60
+ activerecord: '5.2'
61
+ db: postgresql
62
+ dbversion: '9.6'
63
+ - ruby: '2.7'
64
+ activerecord: '6.0'
65
+ db: postgresql
66
+ dbversion: '9.6'
67
+ - ruby: '2.7'
68
+ activerecord: '6.1'
69
+ db: postgresql
70
+ dbversion: '9.6'
71
+ - ruby: '2.7'
72
+ activerecord: '7.0'
73
+ db: postgresql
74
+ dbversion: '9.6'
75
+ - ruby: '3.0'
76
+ activerecord: '6.0'
77
+ db: postgresql
78
+ dbversion: '9.6'
79
+ - ruby: '3.0'
80
+ activerecord: '6.1'
81
+ db: postgresql
82
+ dbversion: '9.6'
83
+ - ruby: '3.0'
84
+ activerecord: '7.0'
85
+ db: postgresql
86
+ dbversion: '9.6'
87
+ - ruby: '3.1'
88
+ activerecord: '6.0'
89
+ db: postgresql
90
+ dbversion: '9.6'
91
+ - ruby: '3.1'
92
+ activerecord: '6.1'
93
+ db: postgresql
94
+ dbversion: '9.6'
95
+ - ruby: '3.1'
96
+ activerecord: '7.0'
97
+ db: postgresql
98
+ dbversion: '9.6'
99
+ env:
100
+ BUNDLE_GEMFILE: "${{ github.workspace }}/gemfiles/activerecord-${{ matrix.activerecord }}/Gemfile.${{ matrix.db }}"
101
+ MYSQL_DB_HOST: 127.0.0.1
102
+ MYSQL_DB_USER: root
103
+ MYSQL_DB_PASS: database
104
+ POSTGRESQL_DB_HOST: 127.0.0.1
105
+ POSTGRESQL_DB_USER: schema_plus_test
106
+ POSTGRESQL_DB_PASS: database
107
+ steps:
108
+ - uses: actions/checkout@v2
109
+ - name: Set up Ruby
110
+ uses: ruby/setup-ruby@v1
111
+ with:
112
+ ruby-version: "${{ matrix.ruby }}"
113
+ bundler-cache: true
114
+ - name: Run bundle update
115
+ run: bundle update
116
+ - name: Start Mysql
117
+ if: matrix.db == 'mysql2'
118
+ run: |
119
+ docker run --rm --detach \
120
+ -e MYSQL_ROOT_PASSWORD=$MYSQL_DB_PASS \
121
+ -p 3306:3306 \
122
+ --health-cmd "mysqladmin ping --host=127.0.0.1 --password=$MYSQL_DB_PASS --silent" \
123
+ --health-interval 5s \
124
+ --health-timeout 5s \
125
+ --health-retries 5 \
126
+ --name database mysql:5.6
127
+ - name: Start Postgresql
128
+ if: matrix.db == 'postgresql'
129
+ run: |
130
+ docker run --rm --detach \
131
+ -e POSTGRES_USER=$POSTGRESQL_DB_USER \
132
+ -e POSTGRES_PASSWORD=$POSTGRESQL_DB_PASS \
133
+ -p 5432:5432 \
134
+ --health-cmd "pg_isready -q" \
135
+ --health-interval 5s \
136
+ --health-timeout 5s \
137
+ --health-retries 5 \
138
+ --name database postgres:${{ matrix.dbversion }}
139
+ - name: Wait for database to start
140
+ if: "(matrix.db == 'postgresql' || matrix.db == 'mysql2')"
141
+ run: |
142
+ COUNT=0
143
+ ATTEMPTS=20
144
+ until [[ $COUNT -eq $ATTEMPTS ]]; do
145
+ [ "$(docker inspect -f {{.State.Health.Status}} database)" == "healthy" ] && break
146
+ echo $(( COUNT++ )) > /dev/null
147
+ sleep 2
148
+ done
149
+ - name: Create testing database
150
+ if: "(matrix.db == 'postgresql' || matrix.db == 'mysql2')"
151
+ run: bundle exec rake create_ci_database
152
+ - name: Run tests
153
+ run: bundle exec rake spec
154
+ - name: Shutdown database
155
+ if: always() && (matrix.db == 'postgresql' || matrix.db == 'mysql2')
156
+ run: docker stop database
157
+ - name: Coveralls Parallel
158
+ if: "${{ !env.ACT }}"
159
+ uses: coverallsapp/github-action@master
160
+ with:
161
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
162
+ flag-name: run-${{ matrix.ruby }}-${{ matrix.activerecord }}-${{ matrix.db }}-${{ matrix.dbversion }}
163
+ parallel: true
164
+ finish:
165
+ needs: test
166
+ runs-on: ubuntu-latest
167
+ steps:
168
+ - name: Coveralls Finished
169
+ if: "${{ !env.ACT }}"
170
+ uses: coverallsapp/github-action@master
171
+ with:
172
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
173
+ parallel-finished: true
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  /tmp
3
3
  /pkg
4
4
  /Gemfile.local
5
+ /.idea
5
6
 
6
7
  *.lock
7
8
  *.log
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
- File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local
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,7 +1,6 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/schema_plus_columns.svg)](http://badge.fury.io/rb/schema_plus_columns)
2
- [![Build Status](https://secure.travis-ci.org/SchemaPlus/schema_plus_columns.svg)](http://travis-ci.org/SchemaPlus/schema_plus_columns)
3
- [![Coverage Status](https://img.shields.io/coveralls/SchemaPlus/schema_plus_columns.svg)](https://coveralls.io/r/SchemaPlus/schema_plus_columns)
4
- [![Dependency Status](https://gemnasium.com/lomba/schema_plus_columns.svg)](https://gemnasium.com/SchemaPlus/schema_plus_columns)
2
+ [![Build Status](https://github.com/SchemaPlus/schema_plus_columns/actions/workflows/pr.yml/badge.svg)](http://github.com/SchemaPlus/schema_plus_columns/actions)
3
+ [![Coverage Status](https://coveralls.io/github/SchemaPlus/schema_plus_columns/badge.svg)](https://coveralls.io/github/SchemaPlus/schema_plus_columns)
5
4
 
6
5
  # SchemaPlus::Columns
7
6
 
@@ -57,22 +56,33 @@ SchemaPlus::Columns is tested on:
57
56
 
58
57
  <!-- SCHEMA_DEV: MATRIX - begin -->
59
58
  <!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->
60
- * ruby **2.3.1** with activerecord **4.2**, using **mysql2**, **sqlite3** or **postgresql**
61
- * ruby **2.3.1** with activerecord **5.0**, using **mysql2**, **sqlite3** or **postgresql**
62
- * ruby **2.3.1** with activerecord **5.1**, using **mysql2**, **sqlite3** or **postgresql**
63
- * ruby **2.3.1** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql**
59
+ * ruby **2.5** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql:9.6**
60
+ * ruby **2.5** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
61
+ * ruby **2.5** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
62
+ * ruby **2.7** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql:9.6**
63
+ * ruby **2.7** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
64
+ * ruby **2.7** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
65
+ * ruby **2.7** with activerecord **7.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
66
+ * ruby **3.0** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
67
+ * ruby **3.0** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
68
+ * ruby **3.0** with activerecord **7.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
69
+ * ruby **3.1** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
70
+ * ruby **3.1** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
71
+ * ruby **3.1** with activerecord **7.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
64
72
 
65
73
  <!-- SCHEMA_DEV: MATRIX - end -->
66
74
 
67
75
 
68
76
  ## Release Notes
69
77
 
70
- * 0.3.0 - AR 5.2
71
- * 0.2.0 - AR 5.1 Support
72
- * 0.1.3 - AR 5.0 Support
73
- * 0.1.2 - Missing require
74
- * 0.1.1 - Explicit gem dependencies
75
- * 0.1.0 - Initial release, extracted from SchemaPlus 1.x
78
+ * **1.0.1** - Add AR 6.1 and 7.0, also add Ruby 3.1 support
79
+ * **1.0.0** - Add AR 6, Drop AR < 5.2, Drop Ruby < 2.5, add Ruby 3.0
80
+ * **0.3.0** - AR 5.2
81
+ * **0.2.0** - AR 5.1 Support
82
+ * **0.1.3** - AR 5.0 Support
83
+ * **0.1.2** - Missing require
84
+ * **0.1.1** - Explicit gem dependencies
85
+ * **0.1.0** - Initial release, extracted from SchemaPlus 1.x
76
86
 
77
87
  ## Development & Testing
78
88
 
@@ -87,7 +97,7 @@ Some things to know about to help you develop and test:
87
97
  * **schema_dev**: SchemaPlus::Columns uses [schema_dev](https://github.com/SchemaPlus/schema_dev) to
88
98
  facilitate running rspec tests on the matrix of ruby, activerecord, and database
89
99
  versions that the gem supports, both locally and on
90
- [travis-ci](http://travis-ci.org/SchemaPlus/schema_plus_columns)
100
+ [github actions](https://github.com/SchemaPlus/schema_plus_columns/actions)
91
101
 
92
102
  To to run rspec locally on the full matrix, do:
93
103
 
@@ -99,7 +109,6 @@ Some things to know about to help you develop and test:
99
109
  The matrix of configurations is specified in `schema_dev.yml` in
100
110
  the project root.
101
111
 
102
-
103
112
  <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - end -->
104
113
 
105
114
  <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_PLUS_CORE - begin -->
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
  Bundler::GemHelper.install_tasks
3
5
 
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
- gemspec :path => File.expand_path('..', __FILE__)
2
+ gemspec path: File.expand_path('..', __FILE__)
3
3
 
4
4
  File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local
@@ -1,3 +1,4 @@
1
- eval File.read File.expand_path('../../Gemfile.base', __FILE__)
1
+ base_gemfile = File.expand_path('../../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile)
2
3
 
3
4
  gem "activerecord", ">= 5.2.0.beta0", "< 5.3"
@@ -1,5 +1,5 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
3
 
4
4
  platform :ruby do
5
5
  gem "mysql2"
@@ -1,5 +1,5 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
3
 
4
4
  platform :ruby do
5
5
  gem "pg"
@@ -1,5 +1,5 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
3
 
4
4
  platform :ruby do
5
5
  gem "sqlite3"
@@ -7,4 +7,4 @@ end
7
7
 
8
8
  platform :jruby do
9
9
  gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2'
10
- end
10
+ end
@@ -0,0 +1,4 @@
1
+ base_gemfile = File.expand_path('../../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile)
3
+
4
+ gem "activerecord", ">= 6.0", "< 6.1"
@@ -0,0 +1,10 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
+
4
+ platform :ruby do
5
+ gem "mysql2"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcmysql-adapter'
10
+ end
@@ -0,0 +1,10 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
+
4
+ platform :ruby do
5
+ gem "pg"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcpostgresql-adapter'
10
+ end
@@ -1,5 +1,5 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
3
 
4
4
  platform :ruby do
5
5
  gem "sqlite3"
@@ -7,4 +7,4 @@ end
7
7
 
8
8
  platform :jruby do
9
9
  gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2'
10
- end
10
+ end
@@ -0,0 +1,4 @@
1
+ base_gemfile = File.expand_path('../../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile)
3
+
4
+ gem "activerecord", ">= 6.1", "< 6.2"
@@ -0,0 +1,10 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
+
4
+ platform :ruby do
5
+ gem "mysql2"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcmysql-adapter'
10
+ end
@@ -0,0 +1,10 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
+
4
+ platform :ruby do
5
+ gem "pg"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcpostgresql-adapter'
10
+ end
@@ -1,5 +1,5 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
3
 
4
4
  platform :ruby do
5
5
  gem "sqlite3"
@@ -7,4 +7,4 @@ end
7
7
 
8
8
  platform :jruby do
9
9
  gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2'
10
- end
10
+ end
@@ -0,0 +1,4 @@
1
+ base_gemfile = File.expand_path('../../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile)
3
+
4
+ gem "activerecord", ">= 7.0", "< 7.1"
@@ -0,0 +1,10 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
+
4
+ platform :ruby do
5
+ gem "mysql2"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcmysql-adapter'
10
+ end
@@ -0,0 +1,10 @@
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
+
4
+ platform :ruby do
5
+ gem "pg"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcpostgresql-adapter'
10
+ end
@@ -1,5 +1,5 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
1
+ base_gemfile = File.expand_path('../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile), binding, base_gemfile
3
3
 
4
4
  platform :ruby do
5
5
  gem "sqlite3"
@@ -7,4 +7,4 @@ end
7
7
 
8
8
  platform :jruby do
9
9
  gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2'
10
- end
10
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SchemaPlus::Columns
2
4
  module ActiveRecord
3
5
  module ConnectionAdapters
@@ -6,6 +8,10 @@ module SchemaPlus::Columns
6
8
  # SchemaPlus::Index adds several methods to Column
7
9
  #
8
10
  module Column
11
+ # AR 6.1+ freezes the columns. Temporary hack until I figure a better way to set the model
12
+ def freeze
13
+ self
14
+ end
9
15
 
10
16
  attr_writer :model # model assigned set by Middleware::Model::Columns
11
17
 
@@ -13,7 +19,7 @@ module SchemaPlus::Columns
13
19
  # refers to this column. Returns an empty list if there are no
14
20
  # such indexes.
15
21
  def indexes
16
- @indexes ||= @model.indexes.select{|index| index.columns.include? self.name}
22
+ @model.indexes.select{|index| index.columns.include? self.name}
17
23
  end
18
24
 
19
25
  # If the column is in a unique index, returns a list of names of other columns in
@@ -62,4 +68,3 @@ module SchemaPlus::Columns
62
68
  end
63
69
  end
64
70
  end
65
-
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SchemaPlus::Columns
2
4
  module Middleware
3
5
  module Model
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SchemaPlus
2
4
  module Columns
3
- VERSION = "0.3.0"
5
+ VERSION = '1.0.1'
4
6
  end
5
7
  end
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'schema_plus/indexes'
2
- require 'its-it'
3
4
 
4
5
  require_relative 'columns/active_record/connection_adapters/column'
5
6
  require_relative 'columns/middleware/model'
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'schema_plus/columns'
data/schema_dev.yml CHANGED
@@ -1,10 +1,13 @@
1
1
  ruby:
2
- - 2.3.1
2
+ - 2.5
3
+ - 2.7
4
+ - 3.0
5
+ - 3.1
3
6
  activerecord:
4
- - 4.2
5
- - 5.0
6
- - 5.1
7
7
  - 5.2
8
+ - 6.0
9
+ - 6.1
10
+ - 7.0
8
11
  db:
9
12
  - mysql2
10
13
  - sqlite3
@@ -1,4 +1,5 @@
1
- # coding: utf-8
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/columns/version'
@@ -17,15 +18,14 @@ Gem::Specification.new do |gem|
17
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
19
  gem.require_paths = ["lib"]
19
20
 
20
- gem.add_dependency "activerecord", ">= 4.2", "< 5.3"
21
- gem.add_dependency "schema_plus_core"
22
- gem.add_dependency "schema_plus_indexes", "~> 0.2"
23
- gem.add_dependency "its-it", "~> 1.2"
21
+ gem.required_ruby_version = '>= 2.5'
22
+
23
+ gem.add_dependency 'activerecord', '>= 5.2', '< 7.1'
24
+ gem.add_dependency 'schema_plus_core', '~> 3.1.0'
25
+ gem.add_dependency 'schema_plus_indexes', '~> 1.0.1'
24
26
 
25
- gem.add_development_dependency "bundler", "~> 1.7"
26
- gem.add_development_dependency "rake", "~> 10.0"
27
- gem.add_development_dependency "rspec", "~> 3.0"
28
- gem.add_development_dependency "schema_dev", "~> 3.6"
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.2.0'
31
31
  end
data/spec/column_spec.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe "Column" do
@@ -22,14 +24,10 @@ describe "Column" do
22
24
  when SchemaDev::Rspec::Helpers.sqlite3?
23
25
  { "sql_type" => "varchar" }
24
26
  end
25
- if Gem::Requirement.new('< 5.0.0.alpha.1').satisfied_by?(::ActiveRecord.version)
26
- expect(JSON.parse(@login.to_json)).to include(type.merge("name" => "login"))
27
- else
28
- expect(JSON.parse(@login.to_json)).to include(
29
- "name" => "login",
30
- "sql_type_metadata" => a_hash_including(type)
31
- )
32
- end
27
+ expect(JSON.parse(@login.to_json)).to include(
28
+ "name" => "login",
29
+ "sql_type_metadata" => a_hash_including(type)
30
+ )
33
31
  end
34
32
  end
35
33
 
@@ -93,13 +91,13 @@ describe "Column" do
93
91
  before(:each) do
94
92
  create_table(User, :login => { :index => {}})
95
93
  User.reset_column_information
96
- @column = User.columns.find(&its.name == "login")
94
+ @column = User.columns.find { |it| it.name == "login" }
97
95
  end
98
96
 
99
97
  context "index", :mysql => :skip do
100
98
 
101
99
  it "reports column as case insensitive" do
102
- allow(User.indexes.first).to receive(:case_sensitive?).and_return(false);
100
+ allow(User.indexes.first).to receive(:case_sensitive?).and_return(false)
103
101
  expect(@column).not_to be_case_sensitive
104
102
  end
105
103
  end
@@ -107,10 +105,16 @@ describe "Column" do
107
105
  context "database", :mysql => :only do
108
106
 
109
107
  # make sure we haven't broken mysql's method
108
+ # mysql determines case insensitivity its own way
110
109
  it "reports column as case insensitive" do
111
- allow(migration).to receive(:collation).and_return("utf8_unicode_ci") # mysql determines case insensitivity its own way
110
+ allow(@column).to receive(:collation).and_return("utf8_unicode_ci")
112
111
  expect(@column).not_to be_case_sensitive
113
112
  end
113
+
114
+ it "reports column as case sensitive" do
115
+ allow(@column).to receive(:collation).and_return("utf8_unicode")
116
+ expect(@column).to be_case_sensitive
117
+ end
114
118
  end
115
119
  end
116
120
 
@@ -142,7 +146,7 @@ describe "Column" do
142
146
  end
143
147
 
144
148
  it "respects array: true" do
145
- column = User.columns.find(&its.name == "alpha")
149
+ column = User.columns.find { |it| it.name == "alpha" }
146
150
  expect(column.array).to be_truthy
147
151
  end
148
152
  end
@@ -153,7 +157,7 @@ describe "Column" do
153
157
  migration.suppress_messages do
154
158
  migration.create_table model.table_name, :force => :cascade do |t|
155
159
  columns_with_options.each_pair do |column, options|
156
- t.send :string, column, options
160
+ t.string column, **options
157
161
  end
158
162
  end
159
163
  model.reset_column_information
data/spec/sanity_spec.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
 
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simplecov'
2
- require 'simplecov-gem-profile'
3
- SimpleCov.start "gem"
4
+ SimpleCov.start unless SimpleCov.running
4
5
 
5
6
  $LOAD_PATH.unshift(File.dirname(__FILE__))
6
7
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -19,4 +20,3 @@ RSpec.configure do |config|
19
20
  end
20
21
 
21
22
  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_columns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.1
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: 2018-06-14 00:00:00.000000000 Z
11
+ date: 2022-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,90 +16,76 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '5.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.3'
22
+ version: '7.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: '4.2'
29
+ version: '5.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.3'
32
+ version: '7.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: schema_plus_indexes
49
35
  requirement: !ruby/object:Gem::Requirement
50
36
  requirements:
51
37
  - - "~>"
52
38
  - !ruby/object:Gem::Version
53
- version: '0.2'
39
+ version: 3.1.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: '0.2'
46
+ version: 3.1.0
61
47
  - !ruby/object:Gem::Dependency
62
- name: its-it
48
+ name: schema_plus_indexes
63
49
  requirement: !ruby/object:Gem::Requirement
64
50
  requirements:
65
51
  - - "~>"
66
52
  - !ruby/object:Gem::Version
67
- version: '1.2'
53
+ version: 1.0.1
68
54
  type: :runtime
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: '1.2'
60
+ version: 1.0.1
75
61
  - !ruby/object:Gem::Dependency
76
62
  name: bundler
77
63
  requirement: !ruby/object:Gem::Requirement
78
64
  requirements:
79
- - - "~>"
65
+ - - ">="
80
66
  - !ruby/object:Gem::Version
81
- version: '1.7'
67
+ version: '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: '1.7'
74
+ version: '0'
89
75
  - !ruby/object:Gem::Dependency
90
76
  name: rake
91
77
  requirement: !ruby/object:Gem::Requirement
92
78
  requirements:
93
79
  - - "~>"
94
80
  - !ruby/object:Gem::Version
95
- version: '10.0'
81
+ version: '13.0'
96
82
  type: :development
97
83
  prerelease: false
98
84
  version_requirements: !ruby/object:Gem::Requirement
99
85
  requirements:
100
86
  - - "~>"
101
87
  - !ruby/object:Gem::Version
102
- version: '10.0'
88
+ version: '13.0'
103
89
  - !ruby/object:Gem::Dependency
104
90
  name: rspec
105
91
  requirement: !ruby/object:Gem::Requirement
@@ -120,72 +106,45 @@ dependencies:
120
106
  requirements:
121
107
  - - "~>"
122
108
  - !ruby/object:Gem::Version
123
- version: '3.6'
109
+ version: 4.2.0
124
110
  type: :development
125
111
  prerelease: false
126
112
  version_requirements: !ruby/object:Gem::Requirement
127
113
  requirements:
128
114
  - - "~>"
129
115
  - !ruby/object:Gem::Version
130
- version: '3.6'
131
- - !ruby/object:Gem::Dependency
132
- name: simplecov
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'
145
- - !ruby/object:Gem::Dependency
146
- name: simplecov-gem-profile
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- version: '0'
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- version: '0'
159
- description:
116
+ version: 4.2.0
117
+ description:
160
118
  email:
161
119
  - ronen@barzel.org
162
120
  executables: []
163
121
  extensions: []
164
122
  extra_rdoc_files: []
165
123
  files:
124
+ - ".github/workflows/prs.yml"
166
125
  - ".gitignore"
167
- - ".travis.yml"
126
+ - ".simplecov"
168
127
  - Gemfile
169
128
  - LICENSE.txt
170
129
  - README.md
171
130
  - Rakefile
172
131
  - gemfiles/Gemfile.base
173
- - gemfiles/activerecord-4.2/Gemfile.base
174
- - gemfiles/activerecord-4.2/Gemfile.mysql2
175
- - gemfiles/activerecord-4.2/Gemfile.postgresql
176
- - gemfiles/activerecord-4.2/Gemfile.sqlite3
177
- - gemfiles/activerecord-5.0/Gemfile.base
178
- - gemfiles/activerecord-5.0/Gemfile.mysql2
179
- - gemfiles/activerecord-5.0/Gemfile.postgresql
180
- - gemfiles/activerecord-5.0/Gemfile.sqlite3
181
- - gemfiles/activerecord-5.1/Gemfile.base
182
- - gemfiles/activerecord-5.1/Gemfile.mysql2
183
- - gemfiles/activerecord-5.1/Gemfile.postgresql
184
- - gemfiles/activerecord-5.1/Gemfile.sqlite3
185
132
  - gemfiles/activerecord-5.2/Gemfile.base
186
133
  - gemfiles/activerecord-5.2/Gemfile.mysql2
187
134
  - gemfiles/activerecord-5.2/Gemfile.postgresql
188
135
  - gemfiles/activerecord-5.2/Gemfile.sqlite3
136
+ - gemfiles/activerecord-6.0/Gemfile.base
137
+ - gemfiles/activerecord-6.0/Gemfile.mysql2
138
+ - gemfiles/activerecord-6.0/Gemfile.postgresql
139
+ - gemfiles/activerecord-6.0/Gemfile.sqlite3
140
+ - gemfiles/activerecord-6.1/Gemfile.base
141
+ - gemfiles/activerecord-6.1/Gemfile.mysql2
142
+ - gemfiles/activerecord-6.1/Gemfile.postgresql
143
+ - gemfiles/activerecord-6.1/Gemfile.sqlite3
144
+ - gemfiles/activerecord-7.0/Gemfile.base
145
+ - gemfiles/activerecord-7.0/Gemfile.mysql2
146
+ - gemfiles/activerecord-7.0/Gemfile.postgresql
147
+ - gemfiles/activerecord-7.0/Gemfile.sqlite3
189
148
  - lib/schema_plus/columns.rb
190
149
  - lib/schema_plus/columns/active_record/connection_adapters/column.rb
191
150
  - lib/schema_plus/columns/middleware/model.rb
@@ -200,7 +159,7 @@ homepage: https://github.com/SchemaPlus/schema_plus_columns
200
159
  licenses:
201
160
  - MIT
202
161
  metadata: {}
203
- post_install_message:
162
+ post_install_message:
204
163
  rdoc_options: []
205
164
  require_paths:
206
165
  - lib
@@ -208,16 +167,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
167
  requirements:
209
168
  - - ">="
210
169
  - !ruby/object:Gem::Version
211
- version: '0'
170
+ version: '2.5'
212
171
  required_rubygems_version: !ruby/object:Gem::Requirement
213
172
  requirements:
214
173
  - - ">="
215
174
  - !ruby/object:Gem::Version
216
175
  version: '0'
217
176
  requirements: []
218
- rubyforge_project:
219
- rubygems_version: 2.5.1
220
- signing_key:
177
+ rubygems_version: 3.1.6
178
+ signing_key:
221
179
  specification_version: 4
222
180
  summary: Adds useful accessors to ActiveRecord's Column object.
223
181
  test_files:
data/.travis.yml DELETED
@@ -1,27 +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.3.1
9
- gemfile:
10
- - gemfiles/activerecord-4.2/Gemfile.mysql2
11
- - gemfiles/activerecord-4.2/Gemfile.postgresql
12
- - gemfiles/activerecord-4.2/Gemfile.sqlite3
13
- - gemfiles/activerecord-5.0/Gemfile.mysql2
14
- - gemfiles/activerecord-5.0/Gemfile.postgresql
15
- - gemfiles/activerecord-5.0/Gemfile.sqlite3
16
- - gemfiles/activerecord-5.1/Gemfile.mysql2
17
- - gemfiles/activerecord-5.1/Gemfile.postgresql
18
- - gemfiles/activerecord-5.1/Gemfile.sqlite3
19
- - gemfiles/activerecord-5.2/Gemfile.mysql2
20
- - gemfiles/activerecord-5.2/Gemfile.postgresql
21
- - gemfiles/activerecord-5.2/Gemfile.sqlite3
22
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
23
- addons:
24
- postgresql: '9.4'
25
- before_script: bundle exec rake create_databases
26
- after_script: bundle exec rake drop_databases
27
- script: bundle exec rake travis
@@ -1,3 +0,0 @@
1
- eval File.read File.expand_path('../../Gemfile.base', __FILE__)
2
-
3
- gem "activerecord", "~> 4.2.6"
@@ -1,10 +0,0 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
3
-
4
- platform :ruby do
5
- gem "mysql2", '>= 0.3.18', '< 0.5'
6
- end
7
-
8
- platform :jruby do
9
- gem 'activerecord-jdbcmysql-adapter'
10
- end
@@ -1,10 +0,0 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
3
-
4
- platform :ruby do
5
- gem "pg"
6
- end
7
-
8
- platform :jruby do
9
- gem 'activerecord-jdbcpostgresql-adapter'
10
- end
@@ -1,3 +0,0 @@
1
- eval File.read File.expand_path('../../Gemfile.base', __FILE__)
2
-
3
- gem "activerecord", "~> 5.0.1"
@@ -1,10 +0,0 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
3
-
4
- platform :ruby do
5
- gem "mysql2"
6
- end
7
-
8
- platform :jruby do
9
- gem 'activerecord-jdbcmysql-adapter'
10
- end
@@ -1,10 +0,0 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
3
-
4
- platform :ruby do
5
- gem "pg"
6
- end
7
-
8
- platform :jruby do
9
- gem 'activerecord-jdbcpostgresql-adapter'
10
- end
@@ -1,3 +0,0 @@
1
- eval File.read File.expand_path('../../Gemfile.base', __FILE__)
2
-
3
- gem "activerecord", "~> 5.1.0"
@@ -1,10 +0,0 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
3
-
4
- platform :ruby do
5
- gem "mysql2"
6
- end
7
-
8
- platform :jruby do
9
- gem 'activerecord-jdbcmysql-adapter'
10
- end
@@ -1,10 +0,0 @@
1
- require "pathname"
2
- eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
3
-
4
- platform :ruby do
5
- gem "pg"
6
- end
7
-
8
- platform :jruby do
9
- gem 'activerecord-jdbcpostgresql-adapter'
10
- end