active_record_doctor 1.4.1 → 1.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +140 -10
- data/lib/active_record_doctor.rb +15 -1
- data/lib/active_record_doctor/printers/io_printer.rb +63 -7
- data/lib/active_record_doctor/railtie.rb +1 -1
- data/lib/active_record_doctor/tasks.rb +6 -0
- data/lib/active_record_doctor/tasks/base.rb +86 -0
- data/lib/active_record_doctor/tasks/extraneous_indexes.rb +5 -26
- data/lib/active_record_doctor/tasks/incorrect_boolean_presence_validation.rb +37 -0
- data/lib/active_record_doctor/tasks/missing_foreign_keys.rb +7 -28
- data/lib/active_record_doctor/tasks/missing_non_null_constraint.rb +56 -0
- data/lib/active_record_doctor/tasks/missing_presence_validation.rb +75 -0
- data/lib/active_record_doctor/tasks/missing_unique_indexes.rb +57 -0
- data/lib/active_record_doctor/tasks/undefined_table_references.rb +22 -21
- data/lib/active_record_doctor/tasks/unindexed_deleted_at.rb +23 -0
- data/lib/active_record_doctor/tasks/unindexed_foreign_keys.rb +7 -28
- data/lib/active_record_doctor/version.rb +1 -1
- data/lib/tasks/active_record_doctor.rake +33 -0
- data/test/active_record_doctor/printers/io_printer_test.rb +15 -7
- data/test/active_record_doctor/tasks/extraneous_indexes_test.rb +69 -19
- data/test/active_record_doctor/tasks/incorrect_boolean_presence_validation_test.rb +38 -0
- data/test/active_record_doctor/tasks/missing_foreign_keys_test.rb +17 -13
- data/test/active_record_doctor/tasks/missing_non_null_constraint_test.rb +113 -0
- data/test/active_record_doctor/tasks/missing_presence_validation_test.rb +115 -0
- data/test/active_record_doctor/tasks/missing_unique_indexes_test.rb +126 -0
- data/test/active_record_doctor/tasks/undefined_table_references_test.rb +39 -11
- data/test/active_record_doctor/tasks/unindexed_deleted_at_test.rb +59 -0
- data/test/active_record_doctor/tasks/unindexed_foreign_keys_test.rb +17 -13
- data/test/setup.rb +97 -0
- metadata +58 -117
- data/Rakefile +0 -28
- data/lib/active_record_doctor/compatibility.rb +0 -11
- data/lib/tasks/active_record_doctor_tasks.rake +0 -22
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/controllers/application_controller.rb +0 -5
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/application_record.rb +0 -3
- data/test/dummy/app/models/comment.rb +0 -3
- data/test/dummy/app/models/contract.rb +0 -3
- data/test/dummy/app/models/employer.rb +0 -2
- data/test/dummy/app/models/profile.rb +0 -2
- data/test/dummy/app/models/user.rb +0 -3
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -29
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -23
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -19
- data/test/dummy/config/database.yml.travis +0 -5
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -41
- data/test/dummy/config/environments/production.rb +0 -79
- data/test/dummy/config/environments/test.rb +0 -47
- data/test/dummy/config/initializers/assets.rb +0 -11
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -56
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/db/migrate/20160213101213_create_employers.rb +0 -13
- data/test/dummy/db/migrate/20160213101221_create_users.rb +0 -23
- data/test/dummy/db/migrate/20160213101232_create_profiles.rb +0 -12
- data/test/dummy/db/migrate/20160604081452_create_comments.rb +0 -11
- data/test/dummy/db/migrate/base_migration.rb +0 -5
- data/test/dummy/db/schema.rb +0 -63
- data/test/dummy/log/development.log +0 -136
- data/test/dummy/log/test.log +0 -1720
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/support/spy_printer.rb +0 -43
- data/test/test_helper.rb +0 -20
@@ -0,0 +1,126 @@
|
|
1
|
+
class ActiveRecordDoctor::Tasks::MissingUniqueIndexesTest < Minitest::Test
|
2
|
+
def test_missing_unique_index
|
3
|
+
Temping.create(:users, temporary: false) do
|
4
|
+
with_columns do |t|
|
5
|
+
t.string :email
|
6
|
+
t.index :email
|
7
|
+
end
|
8
|
+
|
9
|
+
validates :email, uniqueness: true
|
10
|
+
end
|
11
|
+
|
12
|
+
assert_result([
|
13
|
+
['users', [['email']]]
|
14
|
+
])
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_present_unique_index
|
18
|
+
Temping.create(:users, temporary: false) do
|
19
|
+
with_columns do |t|
|
20
|
+
t.string :email
|
21
|
+
t.index :email, unique: true
|
22
|
+
end
|
23
|
+
|
24
|
+
validates :email, uniqueness: true
|
25
|
+
end
|
26
|
+
|
27
|
+
assert_result([])
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_missing_unique_index_with_scope
|
31
|
+
Temping.create(:users, temporary: false) do
|
32
|
+
with_columns do |t|
|
33
|
+
t.string :email
|
34
|
+
t.integer :company_id
|
35
|
+
t.integer :department_id
|
36
|
+
t.index [:company_id, :department_id, :email]
|
37
|
+
end
|
38
|
+
|
39
|
+
validates :email, uniqueness: { scope: [:company_id, :department_id] }
|
40
|
+
end
|
41
|
+
|
42
|
+
assert_result([
|
43
|
+
['users', [['company_id', 'department_id', 'email']]]
|
44
|
+
])
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_present_unique_index_with_scope
|
48
|
+
Temping.create(:users, temporary: false) do
|
49
|
+
with_columns do |t|
|
50
|
+
t.string :email
|
51
|
+
t.integer :company_id
|
52
|
+
t.integer :department_id
|
53
|
+
t.index [:company_id, :department_id, :email], unique: true
|
54
|
+
end
|
55
|
+
|
56
|
+
validates :email, uniqueness: { scope: [:company_id, :department_id] }
|
57
|
+
end
|
58
|
+
|
59
|
+
assert_result([])
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_column_order_is_ignored
|
63
|
+
Temping.create(:users, temporary: false) do
|
64
|
+
with_columns do |t|
|
65
|
+
t.string :email
|
66
|
+
t.integer :organization_id
|
67
|
+
|
68
|
+
t.index [:email, :organization_id], unique: true
|
69
|
+
end
|
70
|
+
|
71
|
+
validates :email, uniqueness: { scope: :organization_id }
|
72
|
+
end
|
73
|
+
|
74
|
+
assert_result([])
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_conditions_is_skipped
|
78
|
+
assert_skipped(conditions: -> { where.not(email: nil) })
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_case_insensitive_is_skipped
|
82
|
+
assert_skipped(case_sensitive: false)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_if_is_skipped
|
86
|
+
assert_skipped(if: ->(model) { true })
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_unless_is_skipped
|
90
|
+
assert_skipped(unless: ->(model) { true })
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_skips_validator_without_attributes
|
94
|
+
Temping.create(:users, temporary: false) do
|
95
|
+
with_columns do |t|
|
96
|
+
t.string :email
|
97
|
+
t.index :email
|
98
|
+
end
|
99
|
+
|
100
|
+
validates_with DummyValidator
|
101
|
+
end
|
102
|
+
|
103
|
+
# There's no need for assert/refute as it's enough the line below doesn't
|
104
|
+
# raise an exception.
|
105
|
+
run_task
|
106
|
+
end
|
107
|
+
|
108
|
+
class DummyValidator < ActiveModel::Validator
|
109
|
+
def validate(record)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
private
|
114
|
+
|
115
|
+
def assert_skipped(options)
|
116
|
+
Temping.create(:users, temporary: false) do
|
117
|
+
with_columns do |t|
|
118
|
+
t.string :email
|
119
|
+
end
|
120
|
+
|
121
|
+
validates :email, uniqueness: options
|
122
|
+
end
|
123
|
+
|
124
|
+
assert_result([])
|
125
|
+
end
|
126
|
+
end
|
@@ -1,19 +1,47 @@
|
|
1
|
-
|
1
|
+
class ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest < Minitest::Test
|
2
|
+
def test_table_exists
|
3
|
+
# No columns needed, just the table.
|
4
|
+
Temping.create(:users, temporary: false)
|
2
5
|
|
3
|
-
|
6
|
+
assert_equal([[], true], run_task)
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_table_does_not_exist
|
10
|
+
# No columns needed, just the table.
|
11
|
+
Temping.create(:users, temporary: false)
|
4
12
|
|
5
|
-
|
6
|
-
|
7
|
-
result = run_task
|
13
|
+
# We drop the underlying table to make the model invalid.
|
14
|
+
ActiveRecord::Base.connection.drop_table(User.table_name)
|
8
15
|
|
9
|
-
|
16
|
+
# We wrap the assertion in begin/ensure because we must recreate the
|
17
|
+
# table as otherwise Temping will raise an error. Assertion errors are
|
18
|
+
# signalled via exceptions which we shouldn't swallow if we don't want to
|
19
|
+
# break the test suite hence the choice of begin/ensure.
|
20
|
+
begin
|
21
|
+
assert_equal([[[User.name, User.table_name]], true], run_task)
|
22
|
+
ensure
|
23
|
+
ActiveRecord::Base.connection.create_table(User.table_name)
|
24
|
+
end
|
10
25
|
end
|
11
26
|
|
12
|
-
|
27
|
+
def test_view_instead_of_table
|
28
|
+
# No columns needed, just the table.
|
29
|
+
Temping.create(:users, temporary: false)
|
30
|
+
|
31
|
+
# We replace the underlying table with a view. The view doesn't have to be
|
32
|
+
# backed by an actual table - it can simply return a predefined tuple.
|
33
|
+
ActiveRecord::Base.connection.drop_table(User.table_name)
|
34
|
+
ActiveRecord::Base.connection.execute("CREATE VIEW users AS SELECT 1")
|
13
35
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
36
|
+
# We wrap the assertion in begin/ensure because we must recreate the
|
37
|
+
# table as otherwise Temping will raise an error. Assertion errors are
|
38
|
+
# signalled via exceptions which we shouldn't swallow if we don't want to
|
39
|
+
# break the test suite hence the choice of begin/ensure.
|
40
|
+
begin
|
41
|
+
assert_equal([[], true], run_task)
|
42
|
+
ensure
|
43
|
+
ActiveRecord::Base.connection.execute("DROP VIEW users")
|
44
|
+
ActiveRecord::Base.connection.create_table(User.table_name)
|
45
|
+
end
|
18
46
|
end
|
19
47
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class ActiveRecordDoctor::Tasks::UnindexedDeletedAtTest < Minitest::Test
|
2
|
+
def test_indexed_deleted_at_is_not_reported
|
3
|
+
Temping.create(:users, temporary: false) do
|
4
|
+
with_columns do |t|
|
5
|
+
t.string :first_name
|
6
|
+
t.string :last_name
|
7
|
+
t.datetime :deleted_at
|
8
|
+
t.index [:first_name, :last_name],
|
9
|
+
name: 'index_profiles_on_first_name_and_last_name',
|
10
|
+
where: 'deleted_at IS NULL'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
assert_result([])
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_unindexed_deleted_at_is_reported
|
18
|
+
Temping.create(:users, temporary: false) do
|
19
|
+
with_columns do |t|
|
20
|
+
t.string :first_name
|
21
|
+
t.string :last_name
|
22
|
+
t.datetime :deleted_at
|
23
|
+
t.index [:first_name, :last_name],
|
24
|
+
name: 'index_profiles_on_first_name_and_last_name'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
assert_result(['index_profiles_on_first_name_and_last_name'])
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_indexed_discarded_at_is_not_reported
|
32
|
+
Temping.create(:users, temporary: false) do
|
33
|
+
with_columns do |t|
|
34
|
+
t.string :first_name
|
35
|
+
t.string :last_name
|
36
|
+
t.datetime :discarded_at
|
37
|
+
t.index [:first_name, :last_name],
|
38
|
+
name: 'index_profiles_on_first_name_and_last_name',
|
39
|
+
where: 'discarded_at IS NULL'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
assert_result([])
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_unindexed_discarded_at_is_reported
|
47
|
+
Temping.create(:users, temporary: false) do
|
48
|
+
with_columns do |t|
|
49
|
+
t.string :first_name
|
50
|
+
t.string :last_name
|
51
|
+
t.datetime :discarded_at
|
52
|
+
t.index [:first_name, :last_name],
|
53
|
+
name: 'index_profiles_on_first_name_and_last_name'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
assert_result(['index_profiles_on_first_name_and_last_name'])
|
58
|
+
end
|
59
|
+
end
|
@@ -1,19 +1,23 @@
|
|
1
|
-
|
1
|
+
class ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest < Minitest::Test
|
2
|
+
def test_unindexed_foreign_key_is_reported
|
3
|
+
Temping.create(:companies, temporary: false)
|
4
|
+
Temping.create(:users, temporary: false) do
|
5
|
+
with_columns do |t|
|
6
|
+
t.references :company, foreign_key: true, index: false
|
7
|
+
end
|
8
|
+
end
|
2
9
|
|
3
|
-
|
4
|
-
|
5
|
-
class ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest < ActiveSupport::TestCase
|
6
|
-
def test_unindexed_foreign_keys_are_reported
|
7
|
-
result = run_task
|
8
|
-
|
9
|
-
assert_equal({ "users" => ["profile_id"] }, result)
|
10
|
+
assert_equal({'users' => ['company_id']}, run_task)
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
+
def test_indexed_foreign_key_is_not_reported
|
14
|
+
Temping.create(:companies, temporary: false)
|
15
|
+
Temping.create(:users, temporary: false) do
|
16
|
+
with_columns do |t|
|
17
|
+
t.references :company, foreign_key: true, index: true
|
18
|
+
end
|
19
|
+
end
|
13
20
|
|
14
|
-
|
15
|
-
printer = SpyPrinter.new
|
16
|
-
ActiveRecordDoctor::Tasks::UnindexedForeignKeys.new(printer: printer).run
|
17
|
-
printer.unindexed_foreign_keys
|
21
|
+
assert_equal({}, run_task)
|
18
22
|
end
|
19
23
|
end
|
data/test/setup.rb
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
# Configure Active Record.
|
2
|
+
|
3
|
+
# We must import "uri" explicitly as otherwsie URI won't be accessible in
|
4
|
+
# Ruby 2.7.2 / Rails 6.
|
5
|
+
require "uri"
|
6
|
+
|
7
|
+
require "active_record"
|
8
|
+
|
9
|
+
# Connect to the database defined in the URL.
|
10
|
+
ActiveRecord::Base.establish_connection(ENV.fetch("DATABASE_URL"))
|
11
|
+
|
12
|
+
# We need to call #connection to enfore Active Record to actually establish
|
13
|
+
# the connection.
|
14
|
+
ActiveRecord::Base.connection
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
# We need to mock Rails because some tasks depend on .eager_load! This must
|
19
|
+
# happen AFTER loading active_record_doctor as otherwise it'd attempt to
|
20
|
+
# install a Railtie.
|
21
|
+
module Rails
|
22
|
+
class TestApplication
|
23
|
+
def eager_load!
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.application
|
28
|
+
@application ||= TestApplication.new
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
# Load Active Record Doctor.
|
35
|
+
require "active_record_doctor"
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
# Configure the test suite.
|
40
|
+
require "minitest"
|
41
|
+
require "minitest/autorun"
|
42
|
+
require "minitest/fork_executor"
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
# temping is a test library for creating tables and models on the fly. We use
|
47
|
+
# it instead of a fixed dummy Rails app created by the generator.
|
48
|
+
require "temping"
|
49
|
+
|
50
|
+
# Temping 3.10.0 is broken because it removes the tables in the order of
|
51
|
+
# creation which fails if foreign key constraints are present.
|
52
|
+
class Temping
|
53
|
+
class << self
|
54
|
+
alias_method :old_teardown, :teardown
|
55
|
+
|
56
|
+
def teardown
|
57
|
+
@model_klasses.reverse!
|
58
|
+
old_teardown
|
59
|
+
|
60
|
+
# This hack is required to avoid leaking temporary model classes defined
|
61
|
+
# by Temping. If we don't clear the cache then they'll be kept around and
|
62
|
+
# returned as valid models which will break tests.
|
63
|
+
ActiveSupport::DescendantsTracker.class_variable_get(:@@direct_descendants).clear
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
# Prepare the test class.
|
71
|
+
class Minitest::Test
|
72
|
+
def teardown
|
73
|
+
# Remove temporary databases created by the current test case.
|
74
|
+
Temping.teardown
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
# Run the appropriate task. The task name is inferred from the test class.
|
80
|
+
def run_task
|
81
|
+
self.class.name.sub(/Test$/, '').constantize.run.first
|
82
|
+
end
|
83
|
+
|
84
|
+
# Assert results are equal without regards to the order of elements.
|
85
|
+
def assert_result(expected_result)
|
86
|
+
assert_equal(expected_result.sort_by(&:to_s), run_task.sort_by(&:to_s))
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Filter out Minitest backtrace while allowing backtrace from other libraries
|
91
|
+
# to be shown.
|
92
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
93
|
+
|
94
|
+
# Run each test method in a separate process so that we avoid leaking
|
95
|
+
# temporary models defined by temping. I'm not entirely sure but it seems to
|
96
|
+
# be a problem with Rails caching those classes aggressively.
|
97
|
+
# Minitest.parallel_executor = Minitest::ForkExecutor.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_doctor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Navis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -39,13 +39,13 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '4.2'
|
48
|
-
type: :
|
48
|
+
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
@@ -53,19 +53,47 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '4.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '4.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '4.2'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: temping
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.10'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.10'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: minitest-fork_executor
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
69
97
|
description:
|
70
98
|
email:
|
71
99
|
- contact@gregnavis.com
|
@@ -75,77 +103,36 @@ extra_rdoc_files: []
|
|
75
103
|
files:
|
76
104
|
- MIT-LICENSE.txt
|
77
105
|
- README.md
|
78
|
-
- Rakefile
|
79
106
|
- lib/active_record_doctor.rb
|
80
|
-
- lib/active_record_doctor/compatibility.rb
|
81
107
|
- lib/active_record_doctor/printers.rb
|
82
108
|
- lib/active_record_doctor/printers/io_printer.rb
|
83
109
|
- lib/active_record_doctor/railtie.rb
|
84
110
|
- lib/active_record_doctor/tasks.rb
|
111
|
+
- lib/active_record_doctor/tasks/base.rb
|
85
112
|
- lib/active_record_doctor/tasks/extraneous_indexes.rb
|
113
|
+
- lib/active_record_doctor/tasks/incorrect_boolean_presence_validation.rb
|
86
114
|
- lib/active_record_doctor/tasks/missing_foreign_keys.rb
|
115
|
+
- lib/active_record_doctor/tasks/missing_non_null_constraint.rb
|
116
|
+
- lib/active_record_doctor/tasks/missing_presence_validation.rb
|
117
|
+
- lib/active_record_doctor/tasks/missing_unique_indexes.rb
|
87
118
|
- lib/active_record_doctor/tasks/undefined_table_references.rb
|
119
|
+
- lib/active_record_doctor/tasks/unindexed_deleted_at.rb
|
88
120
|
- lib/active_record_doctor/tasks/unindexed_foreign_keys.rb
|
89
121
|
- lib/active_record_doctor/version.rb
|
90
122
|
- lib/generators/active_record_doctor/add_indexes/USAGE
|
91
123
|
- lib/generators/active_record_doctor/add_indexes/add_indexes_generator.rb
|
92
|
-
- lib/tasks/
|
124
|
+
- lib/tasks/active_record_doctor.rake
|
93
125
|
- test/active_record_doctor/printers/io_printer_test.rb
|
94
126
|
- test/active_record_doctor/tasks/extraneous_indexes_test.rb
|
127
|
+
- test/active_record_doctor/tasks/incorrect_boolean_presence_validation_test.rb
|
95
128
|
- test/active_record_doctor/tasks/missing_foreign_keys_test.rb
|
129
|
+
- test/active_record_doctor/tasks/missing_non_null_constraint_test.rb
|
130
|
+
- test/active_record_doctor/tasks/missing_presence_validation_test.rb
|
131
|
+
- test/active_record_doctor/tasks/missing_unique_indexes_test.rb
|
96
132
|
- test/active_record_doctor/tasks/undefined_table_references_test.rb
|
133
|
+
- test/active_record_doctor/tasks/unindexed_deleted_at_test.rb
|
97
134
|
- test/active_record_doctor/tasks/unindexed_foreign_keys_test.rb
|
98
|
-
- test/
|
99
|
-
- test/dummy/Rakefile
|
100
|
-
- test/dummy/app/assets/javascripts/application.js
|
101
|
-
- test/dummy/app/assets/stylesheets/application.css
|
102
|
-
- test/dummy/app/controllers/application_controller.rb
|
103
|
-
- test/dummy/app/helpers/application_helper.rb
|
104
|
-
- test/dummy/app/models/application_record.rb
|
105
|
-
- test/dummy/app/models/comment.rb
|
106
|
-
- test/dummy/app/models/contract.rb
|
107
|
-
- test/dummy/app/models/employer.rb
|
108
|
-
- test/dummy/app/models/profile.rb
|
109
|
-
- test/dummy/app/models/user.rb
|
110
|
-
- test/dummy/app/views/layouts/application.html.erb
|
111
|
-
- test/dummy/bin/bundle
|
112
|
-
- test/dummy/bin/rails
|
113
|
-
- test/dummy/bin/rake
|
114
|
-
- test/dummy/bin/setup
|
115
|
-
- test/dummy/config.ru
|
116
|
-
- test/dummy/config/application.rb
|
117
|
-
- test/dummy/config/boot.rb
|
118
|
-
- test/dummy/config/database.yml
|
119
|
-
- test/dummy/config/database.yml.travis
|
120
|
-
- test/dummy/config/environment.rb
|
121
|
-
- test/dummy/config/environments/development.rb
|
122
|
-
- test/dummy/config/environments/production.rb
|
123
|
-
- test/dummy/config/environments/test.rb
|
124
|
-
- test/dummy/config/initializers/assets.rb
|
125
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
126
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
127
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
128
|
-
- test/dummy/config/initializers/inflections.rb
|
129
|
-
- test/dummy/config/initializers/mime_types.rb
|
130
|
-
- test/dummy/config/initializers/session_store.rb
|
131
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
132
|
-
- test/dummy/config/locales/en.yml
|
133
|
-
- test/dummy/config/routes.rb
|
134
|
-
- test/dummy/config/secrets.yml
|
135
|
-
- test/dummy/db/migrate/20160213101213_create_employers.rb
|
136
|
-
- test/dummy/db/migrate/20160213101221_create_users.rb
|
137
|
-
- test/dummy/db/migrate/20160213101232_create_profiles.rb
|
138
|
-
- test/dummy/db/migrate/20160604081452_create_comments.rb
|
139
|
-
- test/dummy/db/migrate/base_migration.rb
|
140
|
-
- test/dummy/db/schema.rb
|
141
|
-
- test/dummy/log/development.log
|
142
|
-
- test/dummy/log/test.log
|
143
|
-
- test/dummy/public/404.html
|
144
|
-
- test/dummy/public/422.html
|
145
|
-
- test/dummy/public/500.html
|
146
|
-
- test/dummy/public/favicon.ico
|
147
|
-
- test/support/spy_printer.rb
|
148
|
-
- test/test_helper.rb
|
135
|
+
- test/setup.rb
|
149
136
|
homepage: https://github.com/gregnavis/active_record_doctor
|
150
137
|
licenses:
|
151
138
|
- MIT
|
@@ -165,65 +152,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
152
|
- !ruby/object:Gem::Version
|
166
153
|
version: '0'
|
167
154
|
requirements: []
|
168
|
-
|
169
|
-
rubygems_version: 2.5.2
|
155
|
+
rubygems_version: 3.1.4
|
170
156
|
signing_key:
|
171
157
|
specification_version: 4
|
172
|
-
summary:
|
158
|
+
summary: Identify database issues before they hit production.
|
173
159
|
test_files:
|
174
|
-
- test/
|
160
|
+
- test/setup.rb
|
175
161
|
- test/active_record_doctor/printers/io_printer_test.rb
|
176
|
-
- test/active_record_doctor/tasks/
|
162
|
+
- test/active_record_doctor/tasks/incorrect_boolean_presence_validation_test.rb
|
163
|
+
- test/active_record_doctor/tasks/unindexed_deleted_at_test.rb
|
177
164
|
- test/active_record_doctor/tasks/extraneous_indexes_test.rb
|
178
|
-
- test/active_record_doctor/tasks/undefined_table_references_test.rb
|
179
165
|
- test/active_record_doctor/tasks/unindexed_foreign_keys_test.rb
|
180
|
-
- test/
|
181
|
-
- test/
|
182
|
-
- test/
|
183
|
-
- test/
|
184
|
-
- test/
|
185
|
-
- test/dummy/bin/setup
|
186
|
-
- test/dummy/bin/bundle
|
187
|
-
- test/dummy/app/helpers/application_helper.rb
|
188
|
-
- test/dummy/app/controllers/application_controller.rb
|
189
|
-
- test/dummy/app/assets/stylesheets/application.css
|
190
|
-
- test/dummy/app/assets/javascripts/application.js
|
191
|
-
- test/dummy/app/views/layouts/application.html.erb
|
192
|
-
- test/dummy/app/models/profile.rb
|
193
|
-
- test/dummy/app/models/comment.rb
|
194
|
-
- test/dummy/app/models/contract.rb
|
195
|
-
- test/dummy/app/models/employer.rb
|
196
|
-
- test/dummy/app/models/user.rb
|
197
|
-
- test/dummy/app/models/application_record.rb
|
198
|
-
- test/dummy/db/schema.rb
|
199
|
-
- test/dummy/db/migrate/20160213101213_create_employers.rb
|
200
|
-
- test/dummy/db/migrate/20160604081452_create_comments.rb
|
201
|
-
- test/dummy/db/migrate/base_migration.rb
|
202
|
-
- test/dummy/db/migrate/20160213101232_create_profiles.rb
|
203
|
-
- test/dummy/db/migrate/20160213101221_create_users.rb
|
204
|
-
- test/dummy/public/404.html
|
205
|
-
- test/dummy/public/500.html
|
206
|
-
- test/dummy/public/422.html
|
207
|
-
- test/dummy/public/favicon.ico
|
208
|
-
- test/dummy/config/secrets.yml
|
209
|
-
- test/dummy/config/application.rb
|
210
|
-
- test/dummy/config/routes.rb
|
211
|
-
- test/dummy/config/environments/development.rb
|
212
|
-
- test/dummy/config/environments/test.rb
|
213
|
-
- test/dummy/config/environments/production.rb
|
214
|
-
- test/dummy/config/database.yml.travis
|
215
|
-
- test/dummy/config/environment.rb
|
216
|
-
- test/dummy/config/database.yml
|
217
|
-
- test/dummy/config/locales/en.yml
|
218
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
219
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
220
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
221
|
-
- test/dummy/config/initializers/session_store.rb
|
222
|
-
- test/dummy/config/initializers/inflections.rb
|
223
|
-
- test/dummy/config/initializers/filter_parameter_logging.rb
|
224
|
-
- test/dummy/config/initializers/assets.rb
|
225
|
-
- test/dummy/config/initializers/mime_types.rb
|
226
|
-
- test/dummy/config/boot.rb
|
227
|
-
- test/dummy/Rakefile
|
228
|
-
- test/dummy/config.ru
|
229
|
-
- test/support/spy_printer.rb
|
166
|
+
- test/active_record_doctor/tasks/missing_unique_indexes_test.rb
|
167
|
+
- test/active_record_doctor/tasks/missing_non_null_constraint_test.rb
|
168
|
+
- test/active_record_doctor/tasks/missing_presence_validation_test.rb
|
169
|
+
- test/active_record_doctor/tasks/undefined_table_references_test.rb
|
170
|
+
- test/active_record_doctor/tasks/missing_foreign_keys_test.rb
|