schema_auto_foreign_keys 0.1.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/prs.yml +134 -0
  3. data/.simplecov +19 -0
  4. data/Gemfile +2 -1
  5. data/README.md +10 -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 → 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-5.0 → activerecord-6.0}/Gemfile.sqlite3 +3 -3
  16. data/lib/schema_auto_foreign_keys/active_record/connection_adapters/sqlite3_adapter.rb +1 -1
  17. data/lib/schema_auto_foreign_keys/middleware/migration.rb +3 -3
  18. data/lib/schema_auto_foreign_keys/middleware/schema.rb +1 -1
  19. data/lib/schema_auto_foreign_keys/version.rb +1 -1
  20. data/lib/schema_auto_foreign_keys.rb +2 -3
  21. data/schema_auto_foreign_keys.gemspec +7 -8
  22. data/schema_dev.yml +5 -3
  23. data/spec/migration_spec.rb +75 -71
  24. data/spec/schema_spec.rb +7 -7
  25. data/spec/spec_helper.rb +2 -3
  26. metadata +29 -71
  27. data/.travis.yml +0 -21
  28. data/gemfiles/activerecord-4.2/Gemfile.base +0 -3
  29. data/gemfiles/activerecord-4.2/Gemfile.mysql2 +0 -10
  30. data/gemfiles/activerecord-4.2/Gemfile.postgresql +0 -10
  31. data/gemfiles/activerecord-5.0/Gemfile.base +0 -3
  32. data/gemfiles/activerecord-5.0/Gemfile.mysql2 +0 -10
  33. data/gemfiles/activerecord-5.0/Gemfile.postgresql +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4341d0ec0137c4eee6b3f89abfa752536f3af622
4
- data.tar.gz: 3cdd82f4202e857413b00f29fbf5de7c234801fb
2
+ SHA256:
3
+ metadata.gz: fa12ac616f5ce5677d2c2bea13ad20164b80adf764066679627ef3e2eec1409d
4
+ data.tar.gz: 8188e920c5d2ba40309203bccba5665ca332fe0b12887c130688aa9894143d25
5
5
  SHA512:
6
- metadata.gz: 7fb530f92d3392f2591792926a4baf5b74238a8d18362da8a5283c07315fc0e10a9e3f684812e6c95e16ef588a2cd1a005e7009c359de5cae705afe816e891a8
7
- data.tar.gz: b0b2514869d54c7d93a79f9a932ecedd19c3abc133c7fdaa2e34636e2dc25b6ea49eedde79bfbba16954eed052b56df3735fe96d0dc3393bc0ad6caabe227bbd
6
+ metadata.gz: 0cef6379c1877ec78c61f0e6a8a807b6892c6ce2396a1e59b15fd0f00b5f1d35b0fc621469f6aaf131b12bd98a238aa955460c70ae597a3d167714716ce26456
7
+ data.tar.gz: 11d4059f62fca77a85d7c59fa0a91795d800be76dd0a57be95d9257e7147304c567b2176fb34ebe36ac0bbaca4c1d9259327bad47b0b8ff4aace56e0d084fb5c
@@ -0,0 +1,134 @@
1
+ # This file was auto-generated by the schema_dev tool, based on the data in
2
+ # ./schema_dev.yml
3
+ # Please do not edit this file; any changes will be overwritten next time
4
+ # schema_dev gets run.
5
+ ---
6
+ name: CI PR Builds
7
+ 'on':
8
+ push:
9
+ branches:
10
+ - master
11
+ pull_request:
12
+ concurrency:
13
+ group: ci-${{ github.ref }}
14
+ cancel-in-progress: true
15
+ jobs:
16
+ test:
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby:
22
+ - '2.5'
23
+ - '2.7'
24
+ - '3.0'
25
+ activerecord:
26
+ - '5.2'
27
+ - '6.0'
28
+ db:
29
+ - mysql2
30
+ - sqlite3
31
+ - skip
32
+ dbversion:
33
+ - skip
34
+ exclude:
35
+ - ruby: '3.0'
36
+ activerecord: '5.2'
37
+ - db: skip
38
+ dbversion: skip
39
+ include:
40
+ - ruby: '2.5'
41
+ activerecord: '5.2'
42
+ db: postgresql
43
+ dbversion: '9.6'
44
+ - ruby: '2.5'
45
+ activerecord: '6.0'
46
+ db: postgresql
47
+ dbversion: '9.6'
48
+ - ruby: '2.7'
49
+ activerecord: '5.2'
50
+ db: postgresql
51
+ dbversion: '9.6'
52
+ - ruby: '2.7'
53
+ activerecord: '6.0'
54
+ db: postgresql
55
+ dbversion: '9.6'
56
+ - ruby: '3.0'
57
+ activerecord: '6.0'
58
+ db: postgresql
59
+ dbversion: '9.6'
60
+ env:
61
+ BUNDLE_GEMFILE: "${{ github.workspace }}/gemfiles/activerecord-${{ matrix.activerecord }}/Gemfile.${{ matrix.db }}"
62
+ MYSQL_DB_HOST: 127.0.0.1
63
+ MYSQL_DB_USER: root
64
+ MYSQL_DB_PASS: database
65
+ POSTGRESQL_DB_HOST: 127.0.0.1
66
+ POSTGRESQL_DB_USER: schema_plus_test
67
+ POSTGRESQL_DB_PASS: database
68
+ steps:
69
+ - uses: actions/checkout@v2
70
+ - name: Set up Ruby
71
+ uses: ruby/setup-ruby@v1
72
+ with:
73
+ ruby-version: "${{ matrix.ruby }}"
74
+ bundler-cache: true
75
+ - name: Run bundle update
76
+ run: bundle update
77
+ - name: Start Mysql
78
+ if: matrix.db == 'mysql2'
79
+ run: |
80
+ docker run --rm --detach \
81
+ -e MYSQL_ROOT_PASSWORD=$MYSQL_DB_PASS \
82
+ -p 3306:3306 \
83
+ --health-cmd "mysqladmin ping --host=127.0.0.1 --password=$MYSQL_DB_PASS --silent" \
84
+ --health-interval 5s \
85
+ --health-timeout 5s \
86
+ --health-retries 5 \
87
+ --name database mysql:5.6
88
+ - name: Start Postgresql
89
+ if: matrix.db == 'postgresql'
90
+ run: |
91
+ docker run --rm --detach \
92
+ -e POSTGRES_USER=$POSTGRESQL_DB_USER \
93
+ -e POSTGRES_PASSWORD=$POSTGRESQL_DB_PASS \
94
+ -p 5432:5432 \
95
+ --health-cmd "pg_isready -q" \
96
+ --health-interval 5s \
97
+ --health-timeout 5s \
98
+ --health-retries 5 \
99
+ --name database postgres:${{ matrix.dbversion }}
100
+ - name: Wait for database to start
101
+ if: "(matrix.db == 'postgresql' || matrix.db == 'mysql2')"
102
+ run: |
103
+ COUNT=0
104
+ ATTEMPTS=20
105
+ until [[ $COUNT -eq $ATTEMPTS ]]; do
106
+ [ "$(docker inspect -f {{.State.Health.Status}} database)" == "healthy" ] && break
107
+ echo $(( COUNT++ )) > /dev/null
108
+ sleep 2
109
+ done
110
+ - name: Create testing database
111
+ if: "(matrix.db == 'postgresql' || matrix.db == 'mysql2')"
112
+ run: bundle exec rake create_ci_database
113
+ - name: Run tests
114
+ run: bundle exec rake spec
115
+ - name: Shutdown database
116
+ if: always() && (matrix.db == 'postgresql' || matrix.db == 'mysql2')
117
+ run: docker stop database
118
+ - name: Coveralls Parallel
119
+ if: "${{ !env.ACT }}"
120
+ uses: coverallsapp/github-action@master
121
+ with:
122
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
123
+ flag-name: run-${{ matrix.ruby }}-${{ matrix.activerecord }}-${{ matrix.db }}-${{ matrix.dbversion }}
124
+ parallel: true
125
+ finish:
126
+ needs: test
127
+ runs-on: ubuntu-latest
128
+ steps:
129
+ - name: Coveralls Finished
130
+ if: "${{ !env.ACT }}"
131
+ uses: coverallsapp/github-action@master
132
+ with:
133
+ github-token: "${{ secrets.GITHUB_TOKEN }}"
134
+ 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,11 @@ 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.3.1** with activerecord **4.2**, using **mysql2**, **sqlite3** or **postgresql**
92
- * ruby **2.3.1** with activerecord **5.0**, 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.7** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql:9.6**
93
+ * ruby **2.7** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
94
+ * ruby **3.0** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6**
93
95
 
94
96
  <!-- SCHEMA_DEV: MATRIX - end -->
95
97
 
@@ -103,6 +105,7 @@ SQlite3 doesn't support renaming the auto-index whtn the table name changes.
103
105
 
104
106
  ## History
105
107
 
108
+ * 1.0.0 - Drop Ruby < 2.5 and Rails < 5.2, add Rails 6.0, and remove many deprecations
106
109
  * 0.1.3 - AR5 (Rails 5) Support
107
110
  * 0.1.2 - Missing require
108
111
  * 0.1.1 - Explicit gem dependencies
@@ -121,7 +124,7 @@ Some things to know about to help you develop and test:
121
124
  * **schema_dev**: SchemaAutoForeignKeys uses [schema_dev](https://github.com/SchemaPlus/schema_dev) to
122
125
  facilitate running rspec tests on the matrix of ruby, activerecord, and database
123
126
  versions that the gem supports, both locally and on
124
- [travis-ci](http://travis-ci.org/SchemaPlus/schema_auto_foreign_keys)
127
+ [github actions](https://github.com/SchemaPlus/schema_auto_foreign_keys/actions)
125
128
 
126
129
  To to run rspec locally on the full matrix, do:
127
130
 
@@ -133,7 +136,6 @@ Some things to know about to help you develop and test:
133
136
  The matrix of configurations is specified in `schema_dev.yml` in
134
137
  the project root.
135
138
 
136
-
137
139
  <!-- SCHEMA_DEV: TEMPLATE USES SCHEMA_DEV - end -->
138
140
 
139
141
 
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
@@ -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.3"
2
+ VERSION = "1.0.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,13 @@ 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 "schema_plus_foreign_keys", "~> 1.0.0"
24
+ gem.add_dependency "schema_plus_indexes", "~> 1.0.0"
25
+
26
+ gem.add_development_dependency "bundler"
27
+ gem.add_development_dependency "rake", "~> 13.0"
27
28
  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"
29
+ gem.add_development_dependency "schema_dev", "~> 4.1"
31
30
  end
data/schema_dev.yml CHANGED
@@ -1,8 +1,10 @@
1
1
  ruby:
2
- - 2.3.1
2
+ - 2.5
3
+ - 2.7
4
+ - 3.0
3
5
  activerecord:
4
- - 4.2
5
- - 5.0
6
+ - 5.2
7
+ - 6.0
6
8
  db:
7
9
  - mysql2
8
10
  - sqlite3
@@ -7,7 +7,7 @@ describe ActiveRecord::Migration do
7
7
  define_schema do
8
8
 
9
9
  create_table :users do |t|
10
- t.string :login, :index => { :unique => true }
10
+ t.string :login, index: { unique: true}
11
11
  end
12
12
 
13
13
  create_table :members do |t|
@@ -17,8 +17,8 @@ describe ActiveRecord::Migration do
17
17
  create_table :comments do |t|
18
18
  t.string :content
19
19
  t.integer :user
20
- t.integer :user_id
21
- t.foreign_key :user_id, :users, :primary_key => :id
20
+ t.bigint :user_id
21
+ t.foreign_key :users, column: :user_id
22
22
  end
23
23
 
24
24
  create_table :posts do |t|
@@ -28,10 +28,13 @@ describe ActiveRecord::Migration do
28
28
  class User < ::ActiveRecord::Base ; end
29
29
  class Post < ::ActiveRecord::Base ; end
30
30
  class Comment < ::ActiveRecord::Base ; end
31
+ User.reset_column_information
32
+ Post.reset_column_information
33
+ Comment.reset_column_information
31
34
  end
32
35
 
33
36
  around(:each) do |example|
34
- with_fk_config(:auto_create => true, :auto_index => true) { example.run }
37
+ with_fk_config(auto_create: true, auto_index: true) { example.run }
35
38
  end
36
39
 
37
40
  context "when table is created" do
@@ -42,14 +45,14 @@ describe ActiveRecord::Migration do
42
45
 
43
46
  it "creates auto foreign keys" do
44
47
  create_table(@model) do |t|
45
- t.integer :user_id
48
+ t.bigint :user_id
46
49
  end
47
50
  expect(@model).to reference(:users, :id).on(:user_id)
48
51
  end
49
52
 
50
53
  it "respects explicit foreign key" do
51
54
  create_table(@model) do |t|
52
- t.integer :author_id, :foreign_key => { :references => :users }
55
+ t.bigint :author_id, foreign_key: { references: :users }
53
56
  end
54
57
  expect(@model).to reference(:users, :id).on(:author_id)
55
58
  expect(@model).to have_index.on(:author_id)
@@ -57,7 +60,7 @@ describe ActiveRecord::Migration do
57
60
 
58
61
  it "suppresses auto foreign key" do
59
62
  create_table(@model) do |t|
60
- t.integer :member_id, :foreign_key => false
63
+ t.bigint :member_id, foreign_key: false
61
64
  end
62
65
  expect(@model).not_to reference.on(:member_id)
63
66
  expect(@model).not_to have_index.on(:member_id)
@@ -65,7 +68,7 @@ describe ActiveRecord::Migration do
65
68
 
66
69
  it "suppresses auto foreign key using shortcut" do
67
70
  create_table(@model) do |t|
68
- t.integer :member_id, :references => nil
71
+ t.bigint :member_id, references: nil
69
72
  end
70
73
  expect(@model).not_to reference.on(:member_id)
71
74
  expect(@model).not_to have_index.on(:member_id)
@@ -85,12 +88,12 @@ describe ActiveRecord::Migration do
85
88
  end
86
89
 
87
90
  it "does not create a foreign_key if polymorphic" do
88
- create_reference(reftype, :post, :polymorphic => true)
91
+ create_reference(reftype, :post, polymorphic: true)
89
92
  expect(@model).not_to reference(:posts, :id).on(:post_id)
90
93
  end
91
94
 
92
- it "does not create a foreign_key with :foreign_key => false" do
93
- create_reference(reftype, :post, :foreign_key => false)
95
+ it "does not create a foreign_key with foreign_key: false" do
96
+ create_reference(reftype, :post, foreign_key: false)
94
97
  expect(@model).not_to reference(:posts, :id).on(:post_id)
95
98
  end
96
99
 
@@ -100,25 +103,25 @@ describe ActiveRecord::Migration do
100
103
  end
101
104
 
102
105
  it "should create exactly one index explicitly (#157)" do
103
- create_reference(reftype, :post, :index => true)
106
+ create_reference(reftype, :post, index: true)
104
107
  expect(@model).to have_index.on(:post_id)
105
108
  end
106
109
 
107
110
  it "should respect :unique (#157)" do
108
- create_reference(reftype, :post, :index => :unique)
111
+ create_reference(reftype, :post, index: :unique)
109
112
  expect(@model).to have_unique_index.on(:post_id)
110
113
  end
111
114
 
112
115
  it "should create a two-column index if polymophic and index requested" do
113
- create_reference(reftype, :post, :polymorphic => true, :index => true)
116
+ create_reference(reftype, :post, polymorphic: true, index: true)
114
117
  expect(@model).to have_index.on([:post_id, :post_type])
115
118
  end
116
119
 
117
120
  protected
118
121
 
119
- def create_reference(reftype, column_name, *args)
122
+ def create_reference(reftype, column_name, **kwargs)
120
123
  create_table(@model) do |t|
121
- t.send reftype, column_name, *args
124
+ t.send reftype, column_name, **kwargs.merge(type: :bigint)
122
125
  end
123
126
  end
124
127
 
@@ -127,9 +130,9 @@ describe ActiveRecord::Migration do
127
130
 
128
131
  it "creates auto-index on foreign keys only" do
129
132
  create_table(@model) do |t|
130
- t.integer :user_id
131
- t.integer :application_id, :references => nil
132
- t.integer :state
133
+ t.bigint :user_id
134
+ t.bigint :application_id, references: nil
135
+ t.bigint :state
133
136
  end
134
137
  expect(@model).to have_index.on(:user_id)
135
138
  expect(@model).not_to have_index.on(:application_id)
@@ -141,52 +144,52 @@ describe ActiveRecord::Migration do
141
144
  column = ("co"*15 + "_id")
142
145
  expect {
143
146
  ActiveRecord::Migration.create_table table do |t|
144
- t.integer column, foreign_key: { references: :members, name: "verylong" }
147
+ t.bigint column, foreign_key: { references: :members, name: "verylong" }
145
148
  end
146
149
  }.not_to raise_error
147
150
  expect(ActiveRecord::Base.connection.indexes(table).first.columns.first).to eq column
148
151
  end
149
152
 
150
153
  it "overrides foreign key auto_create positively" do
151
- with_fk_config(:auto_create => false) do
152
- create_table @model, :foreign_keys => {:auto_create => true} do |t|
153
- t.integer :user_id
154
+ with_fk_config(auto_create: false) do
155
+ create_table @model, foreign_keys: { auto_create: true } do |t|
156
+ t.bigint :user_id
154
157
  end
155
158
  expect(@model).to reference(:users, :id).on(:user_id)
156
159
  end
157
160
  end
158
161
 
159
162
  it "overrides foreign key auto_create negatively" do
160
- with_fk_config(:auto_create => true) do
161
- create_table @model, :foreign_keys => {:auto_create => false} do |t|
162
- t.integer :user_id
163
+ with_fk_config(auto_create: true) do
164
+ create_table @model, foreign_keys: { auto_create: false } do |t|
165
+ t.bigint :user_id
163
166
  end
164
167
  expect(@model).not_to reference.on(:user_id)
165
168
  end
166
169
  end
167
170
 
168
171
  it "overrides foreign key auto_index positively" do
169
- with_fk_config(:auto_index => false) do
170
- create_table @model, :foreign_keys => {:auto_index => true} do |t|
171
- t.integer :user_id
172
+ with_fk_config(auto_index: false) do
173
+ create_table @model, foreign_keys: { auto_index: true } do |t|
174
+ t.bigint :user_id
172
175
  end
173
176
  expect(@model).to have_index.on(:user_id)
174
177
  end
175
178
  end
176
179
 
177
- it "overrides foreign key auto_index negatively", :mysql => :skip do
178
- with_fk_config(:auto_index => true) do
179
- create_table @model, :foreign_keys => {:auto_index => false} do |t|
180
- t.integer :user_id
180
+ it "overrides foreign key auto_index negatively", mysql: :skip do
181
+ with_fk_config(auto_index: true) do
182
+ create_table @model, foreign_keys: { auto_index: false } do |t|
183
+ t.bigint :user_id
181
184
  end
182
185
  expect(@model).not_to have_index.on(:user_id)
183
186
  end
184
187
  end
185
188
 
186
- it "disables auto-index for a column", :mysql => :skip do
187
- with_fk_config(:auto_index => true) do
189
+ it "disables auto-index for a column", mysql: :skip do
190
+ with_fk_config(auto_index: true) do
188
191
  create_table @model do |t|
189
- t.integer :user_id, :index => false
192
+ t.bigint :user_id, index: false
190
193
  end
191
194
  expect(@model).not_to have_index.on(:user_id)
192
195
  end
@@ -194,7 +197,7 @@ describe ActiveRecord::Migration do
194
197
 
195
198
  end
196
199
 
197
- context "when table is changed", :sqlite3 => :skip do
200
+ context "when table is changed", sqlite3: :skip do
198
201
  before(:each) do
199
202
  @model = Post
200
203
  end
@@ -202,8 +205,10 @@ describe ActiveRecord::Migration do
202
205
  suffix = bulk ? ' with :bulk option' : ""
203
206
 
204
207
  it "auto creates a foreign key constraint"+suffix do
205
- change_table(@model, :bulk => bulk) do |t|
206
- t.integer :user_id
208
+ # https://github.com/rails/rails/pull/35958 was never backported to Rails 5.2
209
+ skip("Not supported on MySQL with Rails 5.2") if bulk && ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::Base.connection.adapter_name == "Mysql2"
210
+ change_table(@model, bulk: bulk) do |t|
211
+ t.bigint :user_id
207
212
  end
208
213
  expect(@model).to reference(:users, :id).on(:user_id)
209
214
  end
@@ -211,14 +216,14 @@ describe ActiveRecord::Migration do
211
216
  context "migrate down" do
212
217
  it "removes an auto foreign key and index"+suffix do
213
218
  create_table Comment do |t|
214
- t.integer :user_id
219
+ t.bigint :user_id
215
220
  end
216
221
  expect(Comment).to reference(:users, :id).on(:user_id)
217
222
  expect(Comment).to have_index.on(:user_id)
218
223
  migration = Class.new ::ActiveRecord::Migration.latest_version do
219
224
  define_method(:change) {
220
- change_table("comments", :bulk => bulk) do |t|
221
- t.integer :user_id
225
+ change_table("comments", bulk: bulk) do |t|
226
+ t.bigint :user_id
222
227
  end
223
228
  }
224
229
  end
@@ -231,83 +236,83 @@ describe ActiveRecord::Migration do
231
236
  end
232
237
  end
233
238
 
234
- context "when table is renamed", :postgresql => :only do
239
+ context "when table is renamed", postgresql: :only do
235
240
 
236
241
  before(:each) do
237
242
  @model = Comment
238
243
  create_table @model do |t|
239
- t.integer :user_id
240
- t.integer :xyz, :index => true
244
+ t.bigint :user_id
245
+ t.bigint :xyz, index: true
241
246
  end
242
247
  ActiveRecord::Migration.rename_table @model.table_name, :newname
243
248
  end
244
249
 
245
250
  it "should rename fk indexes" do
246
- index = ActiveRecord::Base.connection.indexes(:newname).find(&its.columns == ['user_id'])
251
+ index = ActiveRecord::Base.connection.indexes(:newname).find { |it| it.columns == ['user_id'] }
247
252
  expect(index.name).to match(/^fk__newname_/)
248
253
  end
249
254
 
250
255
  end
251
256
 
252
- context "when column is added", :sqlite3 => :skip do
257
+ context "when column is added", sqlite3: :skip do
253
258
 
254
259
  before(:each) do
255
260
  @model = Comment
256
261
  end
257
262
 
258
263
  it "auto creates foreign key" do
259
- add_column(:post_id, :integer) do
264
+ add_column(:post_id, :bigint) do
260
265
  expect(@model).to reference(:posts, :id).on(:post_id)
261
266
  end
262
267
  end
263
268
 
264
269
  it "respects explicit foreign key" do
265
- add_column(:author_id, :integer, :foreign_key => { :references => :users }) do
270
+ add_column(:author_id, :bigint, foreign_key: { references: :users }) do
266
271
  expect(@model).to reference(:users, :id).on(:author_id)
267
272
  end
268
273
  end
269
274
 
270
275
  it "doesn't create foreign key if column doesn't look like foreign key" do
271
- add_column(:views_count, :integer) do
276
+ add_column(:views_count, :bigint) do
272
277
  expect(@model).not_to reference.on(:views_count)
273
278
  end
274
279
  end
275
280
 
276
281
  it "doesn't create foreign key if declined explicitly" do
277
- add_column(:post_id, :integer, :foreign_key => false) do
282
+ add_column(:post_id, :bigint, foreign_key: false) do
278
283
  expect(@model).not_to reference.on(:post_id)
279
284
  end
280
285
  end
281
286
 
282
287
  it "shouldn't create foreign key if declined explicitly by shorthand" do
283
- add_column(:post_id, :integer, :references => nil) do
288
+ add_column(:post_id, :bigint, references: nil) do
284
289
  expect(@model).not_to reference.on(:post_id)
285
290
  end
286
291
  end
287
292
 
288
293
  it "creates auto index" do
289
- add_column(:post_id, :integer) do
294
+ add_column(:post_id, :bigint) do
290
295
  expect(@model).to have_index.on(:post_id)
291
296
  end
292
297
  end
293
298
 
294
299
  it "does not create auto-index for non-foreign keys" do
295
- add_column(:state, :integer) do
300
+ add_column(:state, :bigint) do
296
301
  expect(@model).not_to have_index.on(:state)
297
302
  end
298
303
  end
299
304
 
300
305
  # MySQL creates an index on foreign key and we can't override that
301
- it "doesn't create auto-index if declined explicitly", :mysql => :skip do
302
- add_column(:post_id, :integer, :index => false) do
306
+ it "doesn't create auto-index if declined explicitly", mysql: :skip do
307
+ add_column(:post_id, :bigint, index: false) do
303
308
  expect(@model).not_to have_index.on(:post_id)
304
309
  end
305
310
  end
306
311
 
307
312
  protected
308
- def add_column(column_name, *args)
313
+ def add_column(column_name, type, **kwargs)
309
314
  table = @model.table_name
310
- ActiveRecord::Migration.add_column(table, column_name, *args)
315
+ ActiveRecord::Migration.add_column(table, column_name, type, **kwargs)
311
316
  @model.reset_column_information
312
317
  yield if block_given?
313
318
  ActiveRecord::Migration.remove_column(table, column_name)
@@ -321,13 +326,13 @@ describe ActiveRecord::Migration do
321
326
  @model = Comment
322
327
  end
323
328
 
324
- context "with foreign keys", :sqlite3 => :skip do
329
+ context "with foreign keys", sqlite3: :skip do
325
330
 
326
331
  context "and initially references to users table" do
327
332
 
328
333
  before(:each) do
329
334
  create_table @model do |t|
330
- t.integer :user_id
335
+ t.bigint :user_id
331
336
  end
332
337
  end
333
338
 
@@ -336,13 +341,13 @@ describe ActiveRecord::Migration do
336
341
  end
337
342
 
338
343
  it "should drop foreign key if requested to do so" do
339
- change_column :user_id, :integer, :foreign_key => { :references => nil }
344
+ change_column :user_id, :bigint, foreign_key: { references: nil }
340
345
  expect(@model).not_to reference(:users)
341
346
  end
342
347
 
343
- it "should remove auto-created index if foreign key is removed", :mysql => :skip do
348
+ it "should remove auto-created index if foreign key is removed", mysql: :skip do
344
349
  expect(@model).to have_index.on(:user_id) # sanity check that index was auto-created
345
- change_column :user_id, :integer, :foreign_key => { :references => nil }
350
+ change_column :user_id, :bigint, foreign_key: { references: nil }
346
351
  expect(@model).not_to have_index.on(:user_id)
347
352
  end
348
353
 
@@ -351,7 +356,7 @@ describe ActiveRecord::Migration do
351
356
  context "if column defined without foreign key but with index" do
352
357
  before(:each) do
353
358
  create_table @model do |t|
354
- t.integer :user_id, :foreign_key => false, :index => true
359
+ t.bigint :user_id, foreign_key: false, index: true
355
360
  end
356
361
  end
357
362
 
@@ -360,7 +365,7 @@ describe ActiveRecord::Migration do
360
365
  end
361
366
 
362
367
  it "adding foreign key should not fail due to attempt to auto-create existing index" do
363
- expect { change_column :user_id, :integer, :foreign_key => true }.to_not raise_error
368
+ expect { change_column :user_id, :bigint, foreign_key: true }.to_not raise_error
364
369
  end
365
370
  end
366
371
  end
@@ -369,7 +374,7 @@ describe ActiveRecord::Migration do
369
374
 
370
375
  it "doesn't auto-add foreign keys" do
371
376
  create_table @model do |t|
372
- t.integer :user_id, :foreign_key => false
377
+ t.bigint :user_id, foreign_key: false
373
378
  t.string :other_column
374
379
  end
375
380
  with_fk_auto_create do
@@ -381,23 +386,22 @@ describe ActiveRecord::Migration do
381
386
  end
382
387
 
383
388
  protected
384
- def change_column(column_name, *args)
389
+ def change_column(column_name, type, **kwargs)
385
390
  table = @model.table_name
386
- ActiveRecord::Migration.change_column(table, column_name, *args)
391
+ ActiveRecord::Migration.change_column(table, column_name, type, **kwargs)
387
392
  @model.reset_column_information
388
393
  end
389
394
 
390
395
  end
391
396
 
392
397
  def create_table(model, opts={}, &block)
393
- ActiveRecord::Migration.create_table model.table_name, opts.merge(:force => true), &block
398
+ ActiveRecord::Migration.create_table model.table_name, **opts.merge(force: true, id: :bigint), &block
394
399
  model.reset_column_information
395
400
  end
396
401
 
397
402
  def change_table(model, opts={}, &block)
398
- ActiveRecord::Migration.change_table model.table_name, opts, &block
403
+ ActiveRecord::Migration.change_table model.table_name, **opts, &block
399
404
  model.reset_column_information
400
405
  end
401
406
 
402
407
  end
403
-
data/spec/schema_spec.rb CHANGED
@@ -10,19 +10,19 @@ describe ActiveRecord::Schema do
10
10
  with_fk_config(auto_create: true, auto_index: true) do
11
11
  ActiveRecord::Schema.define do
12
12
 
13
- create_table :users, :force => :cascade do
13
+ create_table :users, force: :cascade do
14
14
  end
15
15
 
16
- create_table :colors, :force => :cascade do
16
+ create_table :colors, force: :cascade do
17
17
  end
18
18
 
19
- create_table :shoes, :force => :cascade do
19
+ create_table :shoes, force: :cascade do
20
20
  end
21
21
 
22
- create_table :posts, :force => true do |t|
23
- t.integer :user_id, :references => :users, :index => true
24
- t.integer :shoe_id, :references => :shoes # should not have an index (except mysql)
25
- t.integer :color_id # should not have a foreign key nor index
22
+ create_table :posts, force: true do |t|
23
+ t.bigint :user_id, references: :users, index: true
24
+ t.bigint :shoe_id, references: :shoes # should not have an index (except mysql)
25
+ t.bigint :color_id # should not have a foreign key nor index
26
26
  end
27
27
  end
28
28
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'simplecov'
2
- require 'simplecov-gem-profile'
3
- SimpleCov.start "gem"
2
+ SimpleCov.start
4
3
 
5
4
  $LOAD_PATH.unshift(File.dirname(__FILE__))
6
5
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -37,7 +36,7 @@ def with_fk_config(opts={}, &block)
37
36
  end
38
37
 
39
38
  def with_fk_auto_create(value = true, &block)
40
- with_fk_config(:auto_create => value, &block)
39
+ with_fk_config(auto_create: value, &block)
41
40
  end
42
41
 
43
42
  def define_schema(&block)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_auto_foreign_keys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ronen barzel
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-11 00:00:00.000000000 Z
11
+ date: 2022-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: schema_plus_foreign_keys
@@ -16,70 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: 1.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.1'
26
+ version: 1.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: schema_plus_indexes
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.2'
33
+ version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.2'
41
- - !ruby/object:Gem::Dependency
42
- name: its-it
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.2'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.2'
40
+ version: 1.0.0
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: bundler
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - "~>"
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: '1.7'
47
+ version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - "~>"
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: '1.7'
54
+ version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: '10.0'
61
+ version: '13.0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: '10.0'
68
+ version: '13.0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rspec
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,42 +86,14 @@ dependencies:
100
86
  requirements:
101
87
  - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '3.5'
89
+ version: '4.1'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
94
  - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: '3.5'
111
- - !ruby/object:Gem::Dependency
112
- name: simplecov
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: simplecov-gem-profile
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
96
+ version: '4.1'
139
97
  description: In an ActiveRecord migration, set the default to create a foreign key
140
98
  and index for all columns that define relatoins.
141
99
  email:
@@ -144,21 +102,22 @@ executables: []
144
102
  extensions: []
145
103
  extra_rdoc_files: []
146
104
  files:
105
+ - ".github/workflows/prs.yml"
147
106
  - ".gitignore"
148
- - ".travis.yml"
107
+ - ".simplecov"
149
108
  - Gemfile
150
109
  - LICENSE.txt
151
110
  - README.md
152
111
  - Rakefile
153
112
  - gemfiles/Gemfile.base
154
- - gemfiles/activerecord-4.2/Gemfile.base
155
- - gemfiles/activerecord-4.2/Gemfile.mysql2
156
- - gemfiles/activerecord-4.2/Gemfile.postgresql
157
- - gemfiles/activerecord-4.2/Gemfile.sqlite3
158
- - gemfiles/activerecord-5.0/Gemfile.base
159
- - gemfiles/activerecord-5.0/Gemfile.mysql2
160
- - gemfiles/activerecord-5.0/Gemfile.postgresql
161
- - gemfiles/activerecord-5.0/Gemfile.sqlite3
113
+ - gemfiles/activerecord-5.2/Gemfile.base
114
+ - gemfiles/activerecord-5.2/Gemfile.mysql2
115
+ - gemfiles/activerecord-5.2/Gemfile.postgresql
116
+ - gemfiles/activerecord-5.2/Gemfile.sqlite3
117
+ - gemfiles/activerecord-6.0/Gemfile.base
118
+ - gemfiles/activerecord-6.0/Gemfile.mysql2
119
+ - gemfiles/activerecord-6.0/Gemfile.postgresql
120
+ - gemfiles/activerecord-6.0/Gemfile.sqlite3
162
121
  - lib/schema_auto_foreign_keys.rb
163
122
  - lib/schema_auto_foreign_keys/active_record/connection_adapters/sqlite3_adapter.rb
164
123
  - lib/schema_auto_foreign_keys/middleware/migration.rb
@@ -176,7 +135,7 @@ homepage: https://github.com/SchemaPlus/schema_auto_foreign_keys
176
135
  licenses:
177
136
  - MIT
178
137
  metadata: {}
179
- post_install_message:
138
+ post_install_message:
180
139
  rdoc_options: []
181
140
  require_paths:
182
141
  - lib
@@ -184,16 +143,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
143
  requirements:
185
144
  - - ">="
186
145
  - !ruby/object:Gem::Version
187
- version: '0'
146
+ version: 2.5.0
188
147
  required_rubygems_version: !ruby/object:Gem::Requirement
189
148
  requirements:
190
149
  - - ">="
191
150
  - !ruby/object:Gem::Version
192
151
  version: '0'
193
152
  requirements: []
194
- rubyforge_project:
195
- rubygems_version: 2.5.1
196
- signing_key:
153
+ rubygems_version: 3.0.8
154
+ signing_key:
197
155
  specification_version: 4
198
156
  summary: Automatically define foreign key constraints in ActiveRecord
199
157
  test_files:
data/.travis.yml DELETED
@@ -1,21 +0,0 @@
1
- # This file was auto-generated by the schema_dev tool, based on the data in
2
- # ./schema_dev.yml
3
- # Please do not edit this file; any changes will be overwritten next time
4
- # schema_dev gets run.
5
- ---
6
- sudo: false
7
- rvm:
8
- - 2.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
- env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis
17
- addons:
18
- postgresql: '9.4'
19
- before_script: bundle exec rake create_databases
20
- after_script: bundle exec rake drop_databases
21
- script: bundle exec rake travis
@@ -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.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