traceindex 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +0 -1
- data/README.md +6 -5
- data/lib/traceindex.rb +5 -16
- data/spec/traceroute_spec.rb +13 -0
- data/traceindex.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0a76e873f9bb112b3cd1f98613af8aa41754e426943e22fef117254b1a1309c
|
4
|
+
data.tar.gz: 98cd2a6ab6c7cd985648edc1310cad7197e444b7bb497e6fb4c698fb958a9d95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7b05e1ccfd3f5a79adc80bc3b0412b19dc8ee47b725fa8f9d1ffe5a8c8f9fa4400d05a88465dd2fdc0c32fbe09c9e5d437697a02a72c5caaf3b93ecb1208335
|
7
|
+
data.tar.gz: ed7118e1fd8b2aa65da7422f04963bfeacab40d516d64f79f683b14888be31637b641ad6891866d638f38a64e91e70cdc5f991e2aa683f8410306dd8a98f1442
|
data/.circleci/config.yml
CHANGED
data/README.md
CHANGED
@@ -40,13 +40,14 @@ If you want the rake task to ignore foreign_keys.
|
|
40
40
|
Create a .traceindex.yaml or .traceindex.yml file in your root directory.
|
41
41
|
|
42
42
|
```yaml
|
43
|
+
ignore_tables:
|
44
|
+
- action_mailbox_inbound_emails
|
45
|
+
- action_text_rich_texts
|
46
|
+
- active_storage_attachments
|
47
|
+
- active_storage_blobs
|
48
|
+
- active_storage_variant_records
|
43
49
|
ignore_columns:
|
44
50
|
- users.created_user_id
|
45
|
-
ignore_models:
|
46
|
-
- ActiveStorage::Blob
|
47
|
-
- ActiveStorage::Attachment
|
48
|
-
- ActionText::RichText
|
49
|
-
- ActionMailbox::InboundEmail
|
50
51
|
ignore_foreign_keys:
|
51
52
|
- users.created_user_id
|
52
53
|
```
|
data/lib/traceindex.rb
CHANGED
@@ -9,21 +9,10 @@ class Traceindex
|
|
9
9
|
|
10
10
|
def initialize(app)
|
11
11
|
@app = app
|
12
|
-
@ignore_models = []
|
13
|
-
@ignore_columns = []
|
14
|
-
@ignore_foreign_keys = []
|
15
|
-
|
16
|
-
(config["ignore_models"] || []).each do |ignored_model|
|
17
|
-
@ignore_models << ignored_model
|
18
|
-
end
|
19
|
-
|
20
|
-
(config["ignore_columns"] || []).each do |ignored_column|
|
21
|
-
@ignore_columns << ignored_column
|
22
|
-
end
|
23
|
-
|
24
|
-
(config["ignore_foreign_keys"] || []).each do |ignored_column|
|
25
|
-
@ignore_foreign_keys << ignored_column
|
26
|
-
end
|
12
|
+
@ignore_models = (config["ignore_models"] || [])
|
13
|
+
@ignore_columns = (config["ignore_columns"] || [])
|
14
|
+
@ignore_foreign_keys = (config["ignore_foreign_keys"] || [])
|
15
|
+
@ignore_tables = (config["ignore_tables"] || [])
|
27
16
|
end
|
28
17
|
|
29
18
|
def missing_index_column_names
|
@@ -80,7 +69,7 @@ class Traceindex
|
|
80
69
|
|
81
70
|
@app.eager_load!
|
82
71
|
@models ||= ActiveRecord::Base.descendants.reject(&:abstract_class).reject do |model|
|
83
|
-
@ignore_models.include?(model.name)
|
72
|
+
@ignore_models.include?(model.name) || @ignore_tables.include?(model.table_name)
|
84
73
|
end
|
85
74
|
end
|
86
75
|
end
|
data/spec/traceroute_spec.rb
CHANGED
@@ -42,6 +42,19 @@ describe Traceindex do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
context 'If you have a configuration file(ignore_tables)' do
|
46
|
+
before do
|
47
|
+
File.open '.traceindex.yml', 'w' do |file|
|
48
|
+
file.puts 'ignore_tables:'
|
49
|
+
file.puts ' - users'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'missing index not found.' do
|
54
|
+
expect(traceindex.missing_index_column_names).to eq([])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
45
58
|
context 'If you have a configuration file(ignore_foreign_keys)' do
|
46
59
|
before do
|
47
60
|
File.open '.traceindex.yml', 'w' do |file|
|
data/traceindex.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traceindex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akira Kusumoto
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -91,7 +91,7 @@ homepage: https://github.com/bluerabbit/traceindex
|
|
91
91
|
licenses:
|
92
92
|
- MIT
|
93
93
|
metadata: {}
|
94
|
-
post_install_message:
|
94
|
+
post_install_message:
|
95
95
|
rdoc_options: []
|
96
96
|
require_paths:
|
97
97
|
- lib
|
@@ -106,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
- !ruby/object:Gem::Version
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
|
-
rubygems_version: 3.
|
110
|
-
signing_key:
|
109
|
+
rubygems_version: 3.3.7
|
110
|
+
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: A Rake task that helps you find the missing indexes for your Rails app
|
113
113
|
test_files:
|