schema_auto_foreign_keys 0.1.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/prs.yml +173 -0
  3. data/.simplecov +19 -0
  4. data/Gemfile +2 -1
  5. data/README.md +20 -8
  6. data/Rakefile +1 -1
  7. data/gemfiles/Gemfile.base +1 -1
  8. data/gemfiles/activerecord-5.2/Gemfile.base +4 -0
  9. data/gemfiles/activerecord-5.2/Gemfile.mysql2 +10 -0
  10. data/gemfiles/activerecord-5.2/Gemfile.postgresql +10 -0
  11. data/gemfiles/{activerecord-4.2.0 → activerecord-5.2}/Gemfile.sqlite3 +3 -3
  12. data/gemfiles/activerecord-6.0/Gemfile.base +4 -0
  13. data/gemfiles/activerecord-6.0/Gemfile.mysql2 +10 -0
  14. data/gemfiles/activerecord-6.0/Gemfile.postgresql +10 -0
  15. data/gemfiles/{activerecord-4.2.1 → activerecord-6.0}/Gemfile.sqlite3 +3 -3
  16. data/gemfiles/activerecord-6.1/Gemfile.base +4 -0
  17. data/gemfiles/activerecord-6.1/Gemfile.mysql2 +10 -0
  18. data/gemfiles/activerecord-6.1/Gemfile.postgresql +10 -0
  19. data/gemfiles/activerecord-6.1/Gemfile.sqlite3 +10 -0
  20. data/gemfiles/activerecord-7.0/Gemfile.base +4 -0
  21. data/gemfiles/activerecord-7.0/Gemfile.mysql2 +10 -0
  22. data/gemfiles/activerecord-7.0/Gemfile.postgresql +10 -0
  23. data/gemfiles/activerecord-7.0/Gemfile.sqlite3 +10 -0
  24. data/lib/schema_auto_foreign_keys/active_record/connection_adapters/sqlite3_adapter.rb +1 -1
  25. data/lib/schema_auto_foreign_keys/middleware/migration.rb +3 -3
  26. data/lib/schema_auto_foreign_keys/middleware/schema.rb +1 -1
  27. data/lib/schema_auto_foreign_keys/version.rb +1 -1
  28. data/lib/schema_auto_foreign_keys.rb +2 -3
  29. data/schema_auto_foreign_keys.gemspec +8 -8
  30. data/schema_dev.yml +8 -3
  31. data/spec/migration_spec.rb +76 -72
  32. data/spec/schema_spec.rb +7 -7
  33. data/spec/spec_helper.rb +2 -3
  34. metadata +50 -64
  35. data/.travis.yml +0 -21
  36. data/gemfiles/activerecord-4.2.0/Gemfile.base +0 -3
  37. data/gemfiles/activerecord-4.2.0/Gemfile.mysql2 +0 -10
  38. data/gemfiles/activerecord-4.2.0/Gemfile.postgresql +0 -10
  39. data/gemfiles/activerecord-4.2.1/Gemfile.base +0 -3
  40. data/gemfiles/activerecord-4.2.1/Gemfile.mysql2 +0 -10
  41. data/gemfiles/activerecord-4.2.1/Gemfile.postgresql +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e31cbb38abb0adf0d7efe55e643338002bd7a179
4
- data.tar.gz: 15c2c0d8fbc9f60266a1416f6d1f4a82c14a7e54
2
+ SHA256:
3
+ metadata.gz: 55f81706ea91cc1d110fb64e9ef09aeee7cf124094121a18a54f5198f4695054
4
+ data.tar.gz: 7f808933b2bf19df48f758aa568dfa7829ead1e6c8cf24135212bfe2833e0739
5
5
  SHA512:
6
- metadata.gz: 4d4ae51e777fb3800db8deed920116819781717cb77d4f6acb0bcb298353797d5a95bb0d039ba775dd094b92a465da83e9fd8dbe055c6f26dd915543f2b6c11d
7
- data.tar.gz: 829aa18217d078649951ac39c4f7b7d985cf497fcb445b30915953c714dd9ae3fa6215ee584caa0bc6dbf568f62ba0fb37e1870193226e29fb9f4932407c1f38
6
+ metadata.gz: 729c74ff414f06b54faf2ddf851c29f636f7f8b5e3576aa117b7806cc9e715b4ebb4c94ba02b2a5bf667a15c947295f68ae84d2010fa7b47894ec4bbb3e0bf58
7
+ data.tar.gz: 59a77d7eaaa60c7a32e8e2281cd8674c69b24b4d19cee9350e0df2fc65c0a0f86e1d87257ac6e0ebe679850e577722eb2e97bdf6b1d5cee16d9e908b7da6a4b6
@@ -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/.simplecov ADDED
@@ -0,0 +1,19 @@
1
+ SimpleCov.configure do
2
+ enable_coverage :branch
3
+ add_filter '/spec/'
4
+
5
+ add_group 'Binaries', '/bin/'
6
+ add_group 'Libraries', '/lib/'
7
+
8
+ if ENV['CI']
9
+ require 'simplecov-lcov'
10
+
11
+ SimpleCov::Formatter::LcovFormatter.config do |c|
12
+ c.report_with_single_file = true
13
+ c.single_report_path = 'coverage/lcov.info'
14
+ end
15
+
16
+ formatter SimpleCov::Formatter::LcovFormatter
17
+ end
18
+ end
19
+
data/Gemfile CHANGED
@@ -2,4 +2,5 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local
5
+ gemfile_local = File.expand_path '../Gemfile.local', __FILE__
6
+ 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_auto_foreign_keys.svg)](http://badge.fury.io/rb/schema_auto_foreign_keys)
2
- [![Build Status](https://secure.travis-ci.org/SchemaPlus/schema_auto_foreign_keys.svg)](http://travis-ci.org/SchemaPlus/schema_auto_foreign_keys)
3
- [![Coverage Status](https://img.shields.io/coveralls/SchemaPlus/schema_auto_foreign_keys.svg)](https://coveralls.io/r/SchemaPlus/schema_auto_foreign_keys)
4
- [![Dependency Status](https://gemnasium.com/lomba/schema_auto_foreign_keys.svg)](https://gemnasium.com/SchemaPlus/schema_auto_foreign_keys)
2
+ [![Build Status](https://github.com/SchemaPlus/schema_auto_foreign_keys/actions/workflows/prs.yml/badge.svg)](https://github.com/SchemaPlus/schema_auto_foreign_keys/actions)
3
+ [![Coverage Status](https://coveralls.io/repos/github/SchemaPlus/schema_auto_foreign_keys/badge.svg?branch=master)](https://coveralls.io/github/SchemaPlus/schema_auto_foreign_keys?branch=master)
5
4
 
6
5
  # SchemaAutoForeignKeys
7
6
 
@@ -36,7 +35,7 @@ There is actually one difference between an auto-created index and specifying `i
36
35
  If you need specific paramaters other than the default, you can of course specify them:
37
36
 
38
37
  ```ruby
39
- t.integer :user_id, index: :unique # "has one" relationship between users and this
38
+ t.integer :user_id, index: :unique # "has one" relationship between users and this
40
39
  model
41
40
  t.integer :user_id, on_delete: :cascade
42
41
  ```
@@ -88,8 +87,19 @@ SchemaAutoForeignKeys is tested on:
88
87
 
89
88
  <!-- SCHEMA_DEV: MATRIX - begin -->
90
89
  <!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->
91
- * ruby **2.1.5** with activerecord **4.2.0**, using **mysql2**, **sqlite3** or **postgresql**
92
- * ruby **2.1.5** with activerecord **4.2.1**, using **mysql2**, **sqlite3** or **postgresql**
90
+ * ruby **2.5** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql:9.6**
91
+ * ruby **2.5** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
92
+ * ruby **2.5** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
93
+ * ruby **2.7** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql:9.6**
94
+ * ruby **2.7** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
95
+ * ruby **2.7** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
96
+ * ruby **2.7** with activerecord **7.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
97
+ * ruby **3.0** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
98
+ * ruby **3.0** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
99
+ * ruby **3.0** with activerecord **7.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
100
+ * ruby **3.1** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
101
+ * ruby **3.1** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
102
+ * ruby **3.1** with activerecord **7.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
93
103
 
94
104
  <!-- SCHEMA_DEV: MATRIX - end -->
95
105
 
@@ -103,6 +113,9 @@ SQlite3 doesn't support renaming the auto-index whtn the table name changes.
103
113
 
104
114
  ## History
105
115
 
116
+ * 1.1.0 - Add AR 6.1 and 7.0, Add Ruby 3.1. remvoe schema_plus_compatiblity dependency
117
+ * 1.0.0 - Drop Ruby < 2.5 and Rails < 5.2, add Rails 6.0, and remove many deprecations
118
+ * 0.1.3 - AR5 (Rails 5) Support
106
119
  * 0.1.2 - Missing require
107
120
  * 0.1.1 - Explicit gem dependencies
108
121
  * 0.1.0 - Initial release, extracted from schema_plus 2.0.0.pre*
@@ -120,7 +133,7 @@ Some things to know about to help you develop and test:
120
133
  * **schema_dev**: SchemaAutoForeignKeys uses [schema_dev](https://github.com/SchemaPlus/schema_dev) to
121
134
  facilitate running rspec tests on the matrix of ruby, activerecord, and database
122
135
  versions that the gem supports, both locally and on
123
- [travis-ci](http://travis-ci.org/SchemaPlus/schema_auto_foreign_keys)
136
+ [github actions](https://github.com/SchemaPlus/schema_auto_foreign_keys/actions)
124
137
 
125
138
  To to run rspec locally on the full matrix, do:
126
139
 
@@ -132,7 +145,6 @@ Some things to know about to help you develop and test:
132
145
  The matrix of configurations is specified in `schema_dev.yml` in
133
146
  the project root.
134
147
 
135
-
136
148
  <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - end -->
137
149
 
138
150
 
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ Bundler::GemHelper.install_tasks
3
3
 
4
4
  require 'schema_dev/tasks'
5
5
 
6
- task :default => :spec
6
+ task default: :spec
7
7
 
8
8
  require 'rspec/core/rake_task'
9
9
  RSpec::Core::RakeTask.new(:spec)
@@ -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
@@ -0,0 +1,4 @@
1
+ base_gemfile = File.expand_path('../../Gemfile.base', __FILE__)
2
+ eval File.read(base_gemfile)
3
+
4
+ gem "activerecord", ">= 5.2.0.beta0", "< 5.3"
@@ -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.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
@@ -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 "sqlite3"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2'
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
@@ -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 "sqlite3"
6
+ end
7
+
8
+ platform :jruby do
9
+ gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2'
10
+ end
@@ -7,7 +7,7 @@ module SchemaAutoForeignKeys
7
7
  module Sqlite3Adapter
8
8
 
9
9
  def copy_table(*args, &block)
10
- fk_override = { :auto_create => false, :auto_index => false }
10
+ fk_override = { auto_create: false, auto_index: false }
11
11
  save = Hash[fk_override.keys.collect{|key| [key, SchemaPlus::ForeignKeys.config.send(key)]}]
12
12
  begin
13
13
  SchemaPlus::ForeignKeys.config.update_attributes(fk_override)
@@ -23,14 +23,14 @@ module SchemaAutoForeignKeys
23
23
  oldname = env.table_name
24
24
  indexes = env.connection.indexes(newname)
25
25
  env.connection.foreign_keys(newname).each do |fk|
26
- index = indexes.find(&its.name == AutoCreate.auto_index_name(oldname, fk.column))
26
+ index = indexes.find { |it| it.name == AutoCreate.auto_index_name(oldname, fk.column) }
27
27
  env.connection.rename_index(newname, index.name, AutoCreate.auto_index_name(newname, index.columns)) if index
28
28
  end
29
29
  end
30
30
  end
31
31
  end
32
32
  end
33
-
33
+
34
34
  module AutoCreate
35
35
  def before(env)
36
36
  config ||= env.caller.try(:schema_plus_foreign_keys_config) || SchemaPlus::ForeignKeys.config
@@ -69,7 +69,7 @@ module SchemaAutoForeignKeys
69
69
  end
70
70
 
71
71
  def remove_auto_index(env)
72
- env.caller.remove_index(env.table_name, :name => auto_index_name(env), :column => env.column_name, :if_exists => true)
72
+ env.caller.remove_index(env.table_name, name: auto_index_name(env), column: env.column_name, if_exists: true)
73
73
  end
74
74
 
75
75
  def auto_index_name(env)
@@ -3,7 +3,7 @@ module SchemaAutoForeignKeys
3
3
  module Schema
4
4
  module Define
5
5
  def around(env)
6
- fk_override = { :auto_create => false, :auto_index => false }
6
+ fk_override = { auto_create: false, auto_index: false }
7
7
  save = Hash[fk_override.keys.collect{|key| [key, SchemaPlus::ForeignKeys.config.send(key)]}]
8
8
  begin
9
9
  SchemaPlus::ForeignKeys.config.update_attributes(fk_override)
@@ -1,3 +1,3 @@
1
1
  module SchemaAutoForeignKeys
2
- VERSION = "0.1.2"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -1,6 +1,5 @@
1
1
  require 'schema_plus/foreign_keys'
2
2
  require 'schema_plus/indexes'
3
- require 'its-it'
4
3
 
5
4
  require_relative 'schema_auto_foreign_keys/middleware/migration'
6
5
  require_relative 'schema_auto_foreign_keys/middleware/schema'
@@ -19,14 +18,14 @@ class SchemaPlus::ForeignKeys::Config
19
18
  #
20
19
  # Whether to automatically create foreign key constraints for columns
21
20
  # suffixed with +_id+. Boolean, default is +true+.
22
- has_value :auto_create, :klass => :boolean, :default => true
21
+ has_value :auto_create, klass: :boolean, default: true
23
22
 
24
23
  ##
25
24
  # :attr_accessor: auto_index
26
25
  #
27
26
  # Whether to automatically create indexes when creating foreign key constraints for columns.
28
27
  # Boolean, default is +true+.
29
- has_value :auto_index, :klass => :boolean, :default => true
28
+ has_value :auto_index, klass: :boolean, default: true
30
29
  end
31
30
 
32
31
  SchemaMonkey.register SchemaAutoForeignKeys
@@ -18,14 +18,14 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
- gem.add_dependency "schema_plus_foreign_keys", "~> 0.1"
22
- gem.add_dependency "schema_plus_indexes", "~> 0.2"
23
- gem.add_dependency "its-it", "~> 1.2"
21
+ gem.required_ruby_version = ">= 2.5.0"
24
22
 
25
- gem.add_development_dependency "bundler", "~> 1.7"
26
- gem.add_development_dependency "rake", "~> 10.0"
23
+ gem.add_dependency "activerecord", ">= 5.2", "< 7.1"
24
+ gem.add_dependency "schema_plus_foreign_keys", "~> 1.1.0"
25
+ gem.add_dependency "schema_plus_indexes", "~> 1.0.1"
26
+
27
+ gem.add_development_dependency "bundler"
28
+ gem.add_development_dependency "rake", "~> 13.0"
27
29
  gem.add_development_dependency "rspec", "~> 3.0"
28
- gem.add_development_dependency "schema_dev", "~> 3.5"
29
- gem.add_development_dependency "simplecov"
30
- gem.add_development_dependency "simplecov-gem-profile"
30
+ gem.add_development_dependency "schema_dev", "~> 4.2.0"
31
31
  end
data/schema_dev.yml CHANGED
@@ -1,8 +1,13 @@
1
1
  ruby:
2
- - 2.1.5
2
+ - 2.5
3
+ - 2.7
4
+ - 3.0
5
+ - 3.1
3
6
  activerecord:
4
- - 4.2.0
5
- - 4.2.1
7
+ - 5.2
8
+ - 6.0
9
+ - 6.1
10
+ - 7.0
6
11
  db:
7
12
  - mysql2
8
13
  - sqlite3