schema_auto_foreign_keys 0.1.2 → 1.1.0
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.
- checksums.yaml +5 -5
- data/.github/workflows/prs.yml +173 -0
- data/.simplecov +19 -0
- data/Gemfile +2 -1
- data/README.md +20 -8
- data/Rakefile +1 -1
- data/gemfiles/Gemfile.base +1 -1
- data/gemfiles/activerecord-5.2/Gemfile.base +4 -0
- data/gemfiles/activerecord-5.2/Gemfile.mysql2 +10 -0
- data/gemfiles/activerecord-5.2/Gemfile.postgresql +10 -0
- data/gemfiles/{activerecord-4.2.0 → activerecord-5.2}/Gemfile.sqlite3 +3 -3
- data/gemfiles/activerecord-6.0/Gemfile.base +4 -0
- data/gemfiles/activerecord-6.0/Gemfile.mysql2 +10 -0
- data/gemfiles/activerecord-6.0/Gemfile.postgresql +10 -0
- data/gemfiles/{activerecord-4.2.1 → activerecord-6.0}/Gemfile.sqlite3 +3 -3
- data/gemfiles/activerecord-6.1/Gemfile.base +4 -0
- data/gemfiles/activerecord-6.1/Gemfile.mysql2 +10 -0
- data/gemfiles/activerecord-6.1/Gemfile.postgresql +10 -0
- data/gemfiles/activerecord-6.1/Gemfile.sqlite3 +10 -0
- data/gemfiles/activerecord-7.0/Gemfile.base +4 -0
- data/gemfiles/activerecord-7.0/Gemfile.mysql2 +10 -0
- data/gemfiles/activerecord-7.0/Gemfile.postgresql +10 -0
- data/gemfiles/activerecord-7.0/Gemfile.sqlite3 +10 -0
- data/lib/schema_auto_foreign_keys/active_record/connection_adapters/sqlite3_adapter.rb +1 -1
- data/lib/schema_auto_foreign_keys/middleware/migration.rb +3 -3
- data/lib/schema_auto_foreign_keys/middleware/schema.rb +1 -1
- data/lib/schema_auto_foreign_keys/version.rb +1 -1
- data/lib/schema_auto_foreign_keys.rb +2 -3
- data/schema_auto_foreign_keys.gemspec +8 -8
- data/schema_dev.yml +8 -3
- data/spec/migration_spec.rb +76 -72
- data/spec/schema_spec.rb +7 -7
- data/spec/spec_helper.rb +2 -3
- metadata +50 -64
- data/.travis.yml +0 -21
- data/gemfiles/activerecord-4.2.0/Gemfile.base +0 -3
- data/gemfiles/activerecord-4.2.0/Gemfile.mysql2 +0 -10
- data/gemfiles/activerecord-4.2.0/Gemfile.postgresql +0 -10
- data/gemfiles/activerecord-4.2.1/Gemfile.base +0 -3
- data/gemfiles/activerecord-4.2.1/Gemfile.mysql2 +0 -10
- data/gemfiles/activerecord-4.2.1/Gemfile.postgresql +0 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 55f81706ea91cc1d110fb64e9ef09aeee7cf124094121a18a54f5198f4695054
|
|
4
|
+
data.tar.gz: 7f808933b2bf19df48f758aa568dfa7829ead1e6c8cf24135212bfe2833e0739
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
[](http://badge.fury.io/rb/schema_auto_foreign_keys)
|
|
2
|
-
[](https://gemnasium.com/SchemaPlus/schema_auto_foreign_keys)
|
|
2
|
+
[](https://github.com/SchemaPlus/schema_auto_foreign_keys/actions)
|
|
3
|
+
[](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.
|
|
92
|
-
* ruby **2.
|
|
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
|
-
[
|
|
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
data/gemfiles/Gemfile.base
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
eval
|
|
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,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
eval
|
|
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
|
|
@@ -7,7 +7,7 @@ module SchemaAutoForeignKeys
|
|
|
7
7
|
module Sqlite3Adapter
|
|
8
8
|
|
|
9
9
|
def copy_table(*args, &block)
|
|
10
|
-
fk_override = { :
|
|
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
|
|
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, :
|
|
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 = { :
|
|
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,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, :
|
|
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, :
|
|
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.
|
|
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.
|
|
26
|
-
gem.
|
|
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", "~>
|
|
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
|