schema_plus_foreign_keys 0.1.8 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  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 +43 -27
  7. data/Rakefile +3 -1
  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.0 → 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-4.2.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-4.2.6 → activerecord-7.0}/Gemfile.sqlite3 +3 -3
  25. data/lib/schema_plus/foreign_keys/active_record/base.rb +2 -0
  26. data/lib/schema_plus/foreign_keys/active_record/connection_adapters/abstract/schema_creation.rb +14 -12
  27. data/lib/schema_plus/foreign_keys/active_record/connection_adapters/abstract_adapter.rb +7 -47
  28. data/lib/schema_plus/foreign_keys/active_record/connection_adapters/foreign_key_definition.rb +4 -35
  29. data/lib/schema_plus/foreign_keys/active_record/connection_adapters/mysql2_adapter.rb +15 -16
  30. data/lib/schema_plus/foreign_keys/active_record/connection_adapters/postgresql_adapter.rb +8 -6
  31. data/lib/schema_plus/foreign_keys/active_record/connection_adapters/sqlite3_adapter.rb +8 -6
  32. data/lib/schema_plus/foreign_keys/active_record/connection_adapters/table_definition.rb +7 -46
  33. data/lib/schema_plus/foreign_keys/active_record/migration/command_recorder.rb +4 -2
  34. data/lib/schema_plus/foreign_keys/middleware/dumper.rb +5 -3
  35. data/lib/schema_plus/foreign_keys/middleware/migration.rb +13 -5
  36. data/lib/schema_plus/foreign_keys/middleware/model.rb +2 -0
  37. data/lib/schema_plus/foreign_keys/middleware/mysql.rb +3 -1
  38. data/lib/schema_plus/foreign_keys/middleware/sql.rb +2 -16
  39. data/lib/schema_plus/foreign_keys/version.rb +3 -1
  40. data/lib/schema_plus/foreign_keys.rb +2 -2
  41. data/lib/schema_plus_foreign_keys.rb +2 -0
  42. data/schema_dev.yml +7 -6
  43. data/schema_plus_foreign_keys.gemspec +9 -9
  44. data/spec/deprecation_spec.rb +11 -110
  45. data/spec/foreign_key_definition_spec.rb +5 -3
  46. data/spec/foreign_key_spec.rb +22 -20
  47. data/spec/migration_spec.rb +36 -60
  48. data/spec/named_schemas_spec.rb +16 -14
  49. data/spec/schema_dumper_spec.rb +15 -15
  50. data/spec/spec_helper.rb +5 -4
  51. data/spec/support/reference.rb +3 -2
  52. metadata +35 -99
  53. data/.travis.yml +0 -33
  54. data/gemfiles/activerecord-4.2.0/Gemfile.base +0 -3
  55. data/gemfiles/activerecord-4.2.0/Gemfile.mysql2 +0 -10
  56. data/gemfiles/activerecord-4.2.0/Gemfile.postgresql +0 -10
  57. data/gemfiles/activerecord-4.2.1/Gemfile.base +0 -3
  58. data/gemfiles/activerecord-4.2.1/Gemfile.mysql2 +0 -10
  59. data/gemfiles/activerecord-4.2.1/Gemfile.postgresql +0 -10
  60. data/gemfiles/activerecord-4.2.6/Gemfile.base +0 -3
  61. data/gemfiles/activerecord-4.2.6/Gemfile.mysql2 +0 -10
  62. data/gemfiles/activerecord-4.2.6/Gemfile.postgresql +0 -10
  63. data/gemfiles/activerecord-5.0/Gemfile.base +0 -3
  64. data/gemfiles/activerecord-5.0/Gemfile.mysql2 +0 -10
  65. data/gemfiles/activerecord-5.0/Gemfile.postgresql +0 -10
  66. data/gemfiles/activerecord-5.0/Gemfile.sqlite3 +0 -10
  67. data/gemfiles/activerecord-5.1/Gemfile.base +0 -3
  68. data/gemfiles/activerecord-5.1/Gemfile.mysql2 +0 -10
  69. data/gemfiles/activerecord-5.1/Gemfile.postgresql +0 -10
  70. data/gemfiles/activerecord-5.1/Gemfile.sqlite3 +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 237f5ea4424fd65009b719b0f147d91f0bf3ddecd81cfca4ec385b45cfbea3a4
4
- data.tar.gz: 82818ed615ce5ded6b395a5f9cef23e77560e316fa00b88579d2791c7b7a9d19
3
+ metadata.gz: 245fb0b005d4ddb0375185c9eb8b5831746faa40f16e9bd1202fbc31b1ef12ea
4
+ data.tar.gz: 1ee38608fe9b94b50826468fae70f976acd20d0f091364253440517587e5a377
5
5
  SHA512:
6
- metadata.gz: 5a46e7c27b80fa7877ec1c788e8566e574b724d53ad676e5ae443c79668a545e569bb0dbf9ec28fcc137e44fc64b67b455a721d0b9d76cdff8cd90e6862bd9fe
7
- data.tar.gz: 250f274ce03d0ceea35dccc7e1c9b4cc3775a6802a2a83f64028abd3e38b59cbf17fc502c282c1923389c6ff885c284f33f77c5b99f42d5dbcdb63c79fc08483
6
+ metadata.gz: 813e24f5945c866e42df2717c4378a21ff3f9eb8847df95b5c133af98deca474a1fc2ff6e6c8433b54ec53ddd26a2507351bb6dd2aa0dff6e4f9cd6942fa886c
7
+ data.tar.gz: d64a27dd160a3afc7fb9dc930298905cc617092bcc781f1f87b7f4b222cd43301958993c7897c9cd0ca4a046cbe0400ff68e781db865596031b81ea9d5ddebfd
@@ -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,14 +1,17 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/schema_plus_foreign_keys.svg)](http://badge.fury.io/rb/schema_plus_foreign_keys)
2
- [![Build Status](https://secure.travis-ci.org/SchemaPlus/schema_plus_foreign_keys.svg)](http://travis-ci.org/SchemaPlus/schema_plus_foreign_keys)
3
- [![Coverage Status](https://img.shields.io/coveralls/SchemaPlus/schema_plus_foreign_keys.svg)](https://coveralls.io/r/SchemaPlus/schema_plus_foreign_keys)
2
+ [![Build Status](https://github.com/SchemaPlus/schema_plus_foreign_keys/actions/workflows/prs.yml/badge.svg)](https://github.com/SchemaPlus/schema_plus_foreign_keys/actions)
3
+ [![Coverage Status](https://coveralls.io/repos/github/SchemaPlus/schema_plus_foreign_keys/badge.svg)](https://coveralls.io/github/SchemaPlus/schema_plus_foreign_keys)
4
4
 
5
5
  # SchemaPlus::ForeignKeys
6
6
 
7
- SchemaPlus::ForeignKeys provides extended support in ActiveRecord. This includes extended support for declaraing foreign key constraints in migrations; support for deferrable constraints; support for SQLite3; cleaner schema dumps.
7
+ SchemaPlus::ForeignKeys provides extended support in ActiveRecord. This includes extended support for declaring
8
+ foreign key constraints in migrations; support for deferrable constraints; support for SQLite3; cleaner schema dumps.
8
9
 
9
- SchemaPlus::ForeignKeys is part of the [SchemaPlus](https://github.com/SchemaPlus/) family of Ruby on Rails ActiveRecord extension gems.
10
+ SchemaPlus::ForeignKeys is part of the [SchemaPlus](https://github.com/SchemaPlus/) family of Ruby on Rails ActiveRecord
11
+ extension gems.
10
12
 
11
- For extra convenience, see also [schema_auto_foreign_keys](https://github.com/SchemaPlus/schema_auto_foreign_keys), which creates foriegn key constraints automatically.
13
+ For extra convenience, see also [schema_auto_foreign_keys](https://github.com/SchemaPlus/schema_auto_foreign_keys),
14
+ which creates foriegn key constraints automatically.
12
15
 
13
16
 
14
17
  ## Installation
@@ -29,7 +32,8 @@ gem.add_dependency "schema_plus_foreign_keys" # in a .gemspec
29
32
  ### Migrations
30
33
 
31
34
  To declare a foreign key constraint for a column, use the `:foreign_key`
32
- option. The same options can be used with `t.integer`, `t.references`, `t.belongs_to`, `t.foreign_key`, `change_column`, and `add_foreign_key`:
35
+ option. The same options can be used with `t.integer`, `t.references`, `t.belongs_to`, `t.foreign_key`,
36
+ `change_column`, and `add_foreign_key`:
33
37
 
34
38
  t.references :author, foreign_key: true # create a foreign_key to table "authors"
35
39
  t.references :author, foreign_key: {} # create a foreign_key to table "authors"
@@ -70,7 +74,8 @@ them in a `foreign_key` hash, e.g.
70
74
  t.references :author, on_delete: :cascade # shorthand for foreign_key: { on_delete: :cascade }
71
75
  t.references :author, references: :people # shorthand for foreign_key: { references: :people }
72
76
 
73
- To remove a foreign key constraint, you can either change the column, specifying `foreign_key: false`, or use `migration.remove_foreign_key(table, column)`
77
+ To remove a foreign key constraint, you can either change the column, specifying `foreign_key: false`, or
78
+ use `migration.remove_foreign_key(table, column)`
74
79
 
75
80
  ### Introspection
76
81
 
@@ -131,11 +136,14 @@ foreign key options.
131
136
 
132
137
  ### Schema Dump
133
138
 
134
- For clarity (and because it's required for SQLite3), in the generated `schema_dump.rb` file, the foreign key definitions are inluded within the table definitions.
139
+ For clarity (and because it's required for SQLite3), in the generated `schema_dump.rb` file, the foreign key
140
+ definitions are included within the table definitions.
135
141
 
136
142
  This means that the tables are output sorted that a table is
137
- defined before others that depend on it. If, however, there are circularities in the
138
- foreign key relations, this won't be possible; In that case some table definitions will include comments indicating a "forward reference" to a table that's farther down in the file, and the constraint will be defined once that table is defined (this can never happen with SQLite3).
143
+ defined before others that depend on it. If, however, there are circular dependencies in the
144
+ foreign key relations, this won't be possible; In that case some table definitions will include comments indicating
145
+ a "forward reference" to a table that's farther down in the file, and the constraint will be defined once that table
146
+ is defined (this can never happen with SQLite3).
139
147
 
140
148
 
141
149
  ## Compatibility
@@ -144,26 +152,35 @@ SchemaPlus::ForeignKeys is tested on:
144
152
 
145
153
  <!-- SCHEMA_DEV: MATRIX - begin -->
146
154
  <!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->
147
- * ruby **2.3.1** with activerecord **4.2.0**, using **mysql2**, **sqlite3** or **postgresql**
148
- * ruby **2.3.1** with activerecord **4.2.1**, using **mysql2**, **sqlite3** or **postgresql**
149
- * ruby **2.3.1** with activerecord **4.2.6**, using **mysql2**, **sqlite3** or **postgresql**
150
- * ruby **2.3.1** with activerecord **5.0**, using **mysql2**, **sqlite3** or **postgresql**
151
- * ruby **2.3.1** with activerecord **5.1**, using **mysql2**, **sqlite3** or **postgresql**
152
- * ruby **2.3.1** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql**
155
+ * ruby **2.5** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql:9.6**
156
+ * ruby **2.5** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
157
+ * ruby **2.5** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
158
+ * ruby **2.7** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql:9.6**
159
+ * ruby **2.7** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
160
+ * ruby **2.7** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
161
+ * ruby **2.7** with activerecord **7.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
162
+ * ruby **3.0** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
163
+ * ruby **3.0** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
164
+ * ruby **3.0** with activerecord **7.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
165
+ * ruby **3.1** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
166
+ * ruby **3.1** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6**
167
+ * ruby **3.1** with activerecord **7.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
153
168
 
154
169
  <!-- SCHEMA_DEV: MATRIX - end -->
155
170
 
156
171
  ## History
157
172
 
158
- * 0.1.8 - Compatibility with ActiveRecord 5.1 and ActiveRecord 5.2.
159
- * 0.1.7 - Compatibility with ActiveRecord 5.0.
160
- * 0.1.6 - Missing require
161
- * 0.1.5 - Explicit gem dependencies
162
- * 0.1.4 - Upgrade schema_plus_core dependency
163
- * 0.1.3 - Support aciverecord 4.2.6. Thanks to [@btsuhako](https://github.com/SchemaPlus/schema_plus_foreign_keys/issues?q=is%3Apr+is%3Aopen+author%3Abtsuhako) and [@dholdren](https://github.com/SchemaPlus/schema_plus_foreign_keys/issues?q=is%3Apr+is%3Aopen+author%3Adholdren)
164
- * 0.1.2 - Handle very long names
165
- * 0.1.1 - Cleanup; use (new) core Migration::RenameTable stack rather than monkey patching.
166
- * 0.1.0 - Initial release, brought over from schema_plus 1.x via 2.0.0.pre*
173
+ * **1.1.0** - Add AR 6.1 and 7.0. Add Ruby 3.1, and drop schema_plus_compatibility dependency
174
+ * **1.0.0** - Drop Ruby < 2.5 and Rails < 5.2, adding Rails 6.0, and remove many deprecations
175
+ * **0.1.8** - Compatibility with ActiveRecord 5.1 and ActiveRecord 5.2.
176
+ * **0.1.7** - Compatibility with ActiveRecord 5.0.
177
+ * **0.1.6** - Missing require
178
+ * **0.1.5** - Explicit gem dependencies
179
+ * **0.1.4** - Upgrade schema_plus_core dependency
180
+ * **0.1.3** - Support aciverecord 4.2.6. Thanks to [@btsuhako](https://github.com/SchemaPlus/schema_plus_foreign_keys/issues?q=is%3Apr+is%3Aopen+author%3Abtsuhako) and [@dholdren](https://github.com/SchemaPlus/schema_plus_foreign_keys/issues?q=is%3Apr+is%3Aopen+author%3Adholdren)
181
+ * **0.1.2** - Handle very long names
182
+ * **0.1.1** - Cleanup; use (new) core Migration::RenameTable stack rather than monkey patching.
183
+ * **0.1.0** - Initial release, brought over from schema_plus 1.x via 2.0.0.pre*
167
184
 
168
185
  ## Development & Testing
169
186
 
@@ -178,7 +195,7 @@ Some things to know about to help you develop and test:
178
195
  * **schema_dev**: SchemaPlus::ForeignKeys uses [schema_dev](https://github.com/SchemaPlus/schema_dev) to
179
196
  facilitate running rspec tests on the matrix of ruby, activerecord, and database
180
197
  versions that the gem supports, both locally and on
181
- [travis-ci](http://travis-ci.org/SchemaPlus/schema_plus_foreign_keys)
198
+ [github actions](https://github.com/SchemaPlus/schema_plus_foreign_keys/actions)
182
199
 
183
200
  To to run rspec locally on the full matrix, do:
184
201
 
@@ -190,7 +207,6 @@ Some things to know about to help you develop and test:
190
207
  The matrix of configurations is specified in `schema_dev.yml` in
191
208
  the project root.
192
209
 
193
-
194
210
  <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - end -->
195
211
 
196
212
  <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_PLUS_CORE - begin -->
data/Rakefile CHANGED
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
  Bundler::GemHelper.install_tasks
3
5
 
4
6
  require 'schema_dev/tasks'
5
7
 
6
- task :default => :spec
8
+ task default: :spec
7
9
 
8
10
  require 'rspec/core/rake_task'
9
11
  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
@@ -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::ForeignKeys
2
4
  module ActiveRecord
3
5
 
@@ -1,8 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SchemaPlus
2
4
  module Core
3
5
  module ActiveRecord
4
6
  module ConnectionAdapters
5
- module AbstractAdapter
7
+ if Gem::Version.new(::ActiveRecord::VERSION::STRING) < Gem::Version.new('6.1')
8
+ module AbstractAdapter
9
+ module SchemaCreation
10
+
11
+ def visit_ForeignKeyDefinition(o)
12
+ # schema_plus_foreign_keys already implements a superior
13
+ # conversion of ForeignKeyDefinitions to SQL
14
+ o.to_sql
15
+ end
16
+ end
17
+ end
18
+ else
6
19
  module SchemaCreation
7
20
 
8
21
  def visit_ForeignKeyDefinition(o)
@@ -10,20 +23,9 @@ module SchemaPlus
10
23
  # conversion of ForeignKeyDefinitions to SQL
11
24
  o.to_sql
12
25
  end
13
-
14
- # The TableDefinition::foreign_keys attribute contains ForeignKeyDefinitions instead of
15
- # [to_table, options] tuples when using schema_plus_foreign_keys.
16
- # This function happily accepts to_table and options arguments anyway, so we just ignore
17
- # all arguments and treat to_table as the ForeignKeyDefinition and convert it to SQL
18
- # directly.
19
- def foreign_key_in_create(from_table, to_table, options)
20
- accept to_table # This is the ForeignKeyDefinition
21
- end
22
-
23
26
  end
24
27
  end
25
28
  end
26
29
  end
27
30
  end
28
31
  end
29
-