active_record_doctor 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +25 -0
- data/lib/active_record_doctor/printers/io_printer.rb +9 -0
- data/lib/active_record_doctor/tasks/undefined_table_references.rb +33 -0
- data/lib/active_record_doctor/version.rb +1 -1
- data/lib/tasks/active_record_doctor_tasks.rake +5 -0
- data/test/active_record_doctor/tasks/undefined_table_references_test.rb +19 -0
- data/test/dummy/app/models/contract.rb +3 -0
- data/test/dummy/log/development.log +51 -0
- data/test/dummy/log/test.log +687 -0
- data/test/support/spy_printer.rb +10 -1
- metadata +7 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b34a82d16d09817af606ea87f37d3fd58ed4d90c
|
|
4
|
+
data.tar.gz: 295e95a5bd798fb32fb601b323e534ce1f8d99a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91e990085d0d24165b8ed2c2ffed14e012b903fad6d20239822fb737ba64b117956dc39222be5818cef6bec23ef765eeee8d5d9c37399a52296464a6a27af477
|
|
7
|
+
data.tar.gz: dc076f6c5526717552dca94594d845cbfc105c19d305c38f1dba1442a0d48e5a28197efaabf4cb8d3be259ecf5e5822c337833aa097c899a4c15076866038d45
|
data/README.md
CHANGED
|
@@ -6,6 +6,7 @@ can:
|
|
|
6
6
|
* index unindexed foreign keys
|
|
7
7
|
* detect extraneous indexes
|
|
8
8
|
* detect missing foreign key constraints
|
|
9
|
+
* detect models referencing undefined tables
|
|
9
10
|
|
|
10
11
|
More features coming soon!
|
|
11
12
|
|
|
@@ -140,6 +141,30 @@ class AddForeignKeyConstraintToUsersProfileId < ActiveRecord::Migration
|
|
|
140
141
|
end
|
|
141
142
|
```
|
|
142
143
|
|
|
144
|
+
### Detecting Models Referencing Undefined Tables
|
|
145
|
+
|
|
146
|
+
Active Record guesses the table name based on the class name. There are a few
|
|
147
|
+
cases where the name can be wrong (e.g. you forgot to commit a migration or
|
|
148
|
+
changed the table name). Active Record Doctor can help you identify these cases
|
|
149
|
+
before they hit production.
|
|
150
|
+
|
|
151
|
+
The only think you need to do is run:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
rake active_record_doctor:undefined_table_references
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
If there a model references an undefined table then you'll see a message like
|
|
158
|
+
this:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
The following models reference undefined tables:
|
|
162
|
+
Contract (the table contract_records is undefined)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
On top of that `rake` will exit with status code of 1. This allows you to use
|
|
166
|
+
this check as part of your Continuous Integration pipeline.
|
|
167
|
+
|
|
143
168
|
## Author
|
|
144
169
|
|
|
145
170
|
This gem is developed and maintained by [Greg Navis](http://www.gregnavis.com).
|
|
@@ -35,6 +35,15 @@ module ActiveRecordDoctor
|
|
|
35
35
|
"#{table} #{columns.sort.join(' ')}"
|
|
36
36
|
end.join("\n"))
|
|
37
37
|
end
|
|
38
|
+
|
|
39
|
+
def print_undefined_table_references(models)
|
|
40
|
+
return if models.empty?
|
|
41
|
+
|
|
42
|
+
@io.puts('The following models reference undefined tables:')
|
|
43
|
+
models.each do |model|
|
|
44
|
+
@io.puts(" #{model.name} (the table #{model.table_name} is undefined)")
|
|
45
|
+
end
|
|
46
|
+
end
|
|
38
47
|
end
|
|
39
48
|
end
|
|
40
49
|
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require "active_record_doctor/compatibility"
|
|
2
|
+
require "active_record_doctor/printers/io_printer"
|
|
3
|
+
|
|
4
|
+
module ActiveRecordDoctor
|
|
5
|
+
module Tasks
|
|
6
|
+
class UndefinedTableReferences
|
|
7
|
+
include Compatibility
|
|
8
|
+
|
|
9
|
+
def self.run
|
|
10
|
+
new.run
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def initialize(printer: ActiveRecordDoctor::Printers::IOPrinter.new)
|
|
14
|
+
@printer = printer
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def run
|
|
18
|
+
@printer.print_undefined_table_references(undefined_table_references)
|
|
19
|
+
undefined_table_references.present? ? 1 : 0
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def undefined_table_references
|
|
25
|
+
Rails.application.eager_load!
|
|
26
|
+
|
|
27
|
+
ActiveRecord::Base.subclasses.reject do |model|
|
|
28
|
+
model.connection.tables.include?(model.table_name)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require "active_record_doctor/tasks/unindexed_foreign_keys"
|
|
2
2
|
require "active_record_doctor/tasks/extraneous_indexes"
|
|
3
3
|
require "active_record_doctor/tasks/missing_foreign_keys"
|
|
4
|
+
require "active_record_doctor/tasks/undefined_table_references"
|
|
4
5
|
|
|
5
6
|
namespace :active_record_doctor do
|
|
6
7
|
task :unindexed_foreign_keys => :environment do
|
|
@@ -14,4 +15,8 @@ namespace :active_record_doctor do
|
|
|
14
15
|
task :missing_foreign_keys => :environment do
|
|
15
16
|
ActiveRecordDoctor::Tasks::MissingForeignKeys.run
|
|
16
17
|
end
|
|
18
|
+
|
|
19
|
+
task :undefined_table_references => :environment do
|
|
20
|
+
exit(ActiveRecordDoctor::Tasks::UndefinedTableReferences.run)
|
|
21
|
+
end
|
|
17
22
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
require 'active_record_doctor/tasks/undefined_table_references'
|
|
4
|
+
|
|
5
|
+
class ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest < ActiveSupport::TestCase
|
|
6
|
+
def test_undefined_table_references_are_reported
|
|
7
|
+
result = run_task
|
|
8
|
+
|
|
9
|
+
assert_equal([Contract], result)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def run_task
|
|
15
|
+
printer = SpyPrinter.new
|
|
16
|
+
ActiveRecordDoctor::Tasks::UndefinedTableReferences.new(printer: printer).run
|
|
17
|
+
printer.undefined_table_references
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -83,3 +83,54 @@ WHERE c.contype = 'f'
|
|
|
83
83
|
AND t3.nspname = ANY (current_schemas(false))
|
|
84
84
|
ORDER BY c.conname
|
|
85
85
|
|
|
86
|
+
[1m[36mSQL (0.1ms)[0m [1mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
|
87
|
+
[1m[35m (31.0ms)[0m CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
|
88
|
+
[1m[36m (17.6ms)[0m [1mCREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" USING btree ("commentable_type", "commentable_id")[0m
|
|
89
|
+
[1m[35m (34.4ms)[0m CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
|
90
|
+
[1m[36m (12.9ms)[0m [1mCREATE INDEX "index_employers_on_id" ON "employers" USING btree ("id")[0m
|
|
91
|
+
[1m[35m (31.9ms)[0m CREATE TABLE "profiles" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
|
92
|
+
[1m[36m (35.7ms)[0m [1mCREATE TABLE "users" ("id" serial primary key, "email" character varying, "first_name" character varying, "last_name" character varying, "profile_id" integer, "employer_id" integer, "country_code" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) [0m
|
|
93
|
+
[1m[35m (18.0ms)[0m CREATE INDEX "index_users_on_email" ON "users" USING btree ("email")
|
|
94
|
+
[1m[36m (18.2ms)[0m [1mCREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" USING btree ("email")[0m
|
|
95
|
+
[1m[35m (18.2ms)[0m CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" USING btree ("employer_id", "country_code")
|
|
96
|
+
[1m[36m (12.9ms)[0m [1mCREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" USING btree ("last_name", "first_name", "email")[0m
|
|
97
|
+
[1m[35m (23.8ms)[0m CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")
|
|
98
|
+
[1m[36m (21.1ms)[0m [1mCREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")[0m
|
|
99
|
+
[1m[35m (24.6ms)[0m CREATE INDEX "index_users_on_last_name" ON "users" USING btree ("last_name")
|
|
100
|
+
[1m[36m (9.2ms)[0m [1mALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
|
|
101
|
+
FOREIGN KEY ("employer_id")
|
|
102
|
+
REFERENCES "employers" ("id")
|
|
103
|
+
[0m
|
|
104
|
+
[1m[35m (26.4ms)[0m CREATE TABLE "schema_migrations" ("version" character varying NOT NULL)
|
|
105
|
+
[1m[36m (26.6ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
|
106
|
+
[1m[35m (0.3ms)[0m SELECT version FROM "schema_migrations"
|
|
107
|
+
[1m[36m (2.1ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20160604081452')[0m
|
|
108
|
+
[1m[35m (7.6ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20160213101213')
|
|
109
|
+
[1m[36m (7.5ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20160213101232')[0m
|
|
110
|
+
[1m[35m (2.1ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20160213101221')
|
|
111
|
+
[1m[36mSQL (0.1ms)[0m [1mCREATE EXTENSION IF NOT EXISTS "plpgsql"[0m
|
|
112
|
+
[1m[35m (57.5ms)[0m CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
|
113
|
+
[1m[36m (20.9ms)[0m [1mCREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" USING btree ("commentable_type", "commentable_id")[0m
|
|
114
|
+
[1m[35m (46.0ms)[0m CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
|
115
|
+
[1m[36m (12.2ms)[0m [1mCREATE INDEX "index_employers_on_id" ON "employers" USING btree ("id")[0m
|
|
116
|
+
[1m[35m (29.4ms)[0m CREATE TABLE "profiles" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
|
|
117
|
+
[1m[36m (32.3ms)[0m [1mCREATE TABLE "users" ("id" serial primary key, "email" character varying, "first_name" character varying, "last_name" character varying, "profile_id" integer, "employer_id" integer, "country_code" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) [0m
|
|
118
|
+
[1m[35m (17.2ms)[0m CREATE INDEX "index_users_on_email" ON "users" USING btree ("email")
|
|
119
|
+
[1m[36m (14.7ms)[0m [1mCREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" USING btree ("email")[0m
|
|
120
|
+
[1m[35m (22.9ms)[0m CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" USING btree ("employer_id", "country_code")
|
|
121
|
+
[1m[36m (17.8ms)[0m [1mCREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" USING btree ("last_name", "first_name", "email")[0m
|
|
122
|
+
[1m[35m (17.3ms)[0m CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")
|
|
123
|
+
[1m[36m (22.9ms)[0m [1mCREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")[0m
|
|
124
|
+
[1m[35m (11.8ms)[0m CREATE INDEX "index_users_on_last_name" ON "users" USING btree ("last_name")
|
|
125
|
+
[1m[36m (8.5ms)[0m [1mALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
|
|
126
|
+
FOREIGN KEY ("employer_id")
|
|
127
|
+
REFERENCES "employers" ("id")
|
|
128
|
+
[0m
|
|
129
|
+
[1m[35m (21.3ms)[0m CREATE TABLE "schema_migrations" ("version" character varying NOT NULL)
|
|
130
|
+
[1m[36m (20.4ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
|
131
|
+
[1m[35m (0.2ms)[0m SELECT version FROM "schema_migrations"
|
|
132
|
+
[1m[36m (4.9ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20160604081452')[0m
|
|
133
|
+
[1m[35m (7.6ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20160213101213')
|
|
134
|
+
[1m[36m (7.3ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('20160213101232')[0m
|
|
135
|
+
[1m[35m (1.9ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('20160213101221')
|
|
136
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
data/test/dummy/log/test.log
CHANGED
|
@@ -139,3 +139,690 @@ ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_re
|
|
|
139
139
|
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
140
140
|
---------------------------------------------------------------------------------------------
|
|
141
141
|
[1m[35m (0.0ms)[0m ROLLBACK
|
|
142
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
143
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
144
|
+
----------------------------------------------------------------------------------
|
|
145
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
146
|
+
----------------------------------------------------------------------------------
|
|
147
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
148
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
149
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
150
|
+
----------------------------------------------------------------------------------
|
|
151
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
152
|
+
----------------------------------------------------------------------------------
|
|
153
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
154
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
155
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
156
|
+
----------------------------------------------------------------------------------
|
|
157
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
158
|
+
----------------------------------------------------------------------------------
|
|
159
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
|
160
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
161
|
+
[1m[35m (0.2ms)[0m BEGIN
|
|
162
|
+
----------------------------------------------------------------------------------
|
|
163
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
164
|
+
----------------------------------------------------------------------------------
|
|
165
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
166
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
167
|
+
[1m[35m (0.2ms)[0m BEGIN
|
|
168
|
+
----------------------------------------------------------------------------------
|
|
169
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
170
|
+
----------------------------------------------------------------------------------
|
|
171
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
172
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
173
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
174
|
+
----------------------------------------------------------------------------------
|
|
175
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
176
|
+
----------------------------------------------------------------------------------
|
|
177
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
178
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
179
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
180
|
+
----------------------------------------------------------------------------------
|
|
181
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
182
|
+
----------------------------------------------------------------------------------
|
|
183
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
|
184
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
185
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
186
|
+
----------------------------------------------------------------------------------
|
|
187
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
188
|
+
----------------------------------------------------------------------------------
|
|
189
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
190
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
191
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
192
|
+
----------------------------------------------------------------------------------
|
|
193
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
194
|
+
----------------------------------------------------------------------------------
|
|
195
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
196
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
197
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
198
|
+
----------------------------------------------------------------------------------
|
|
199
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
200
|
+
----------------------------------------------------------------------------------
|
|
201
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
202
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
203
|
+
[1m[35m (0.2ms)[0m BEGIN
|
|
204
|
+
----------------------------------------------------------------------------------
|
|
205
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
206
|
+
----------------------------------------------------------------------------------
|
|
207
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
208
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
209
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
210
|
+
---------------------------------------------------------------------------------------------
|
|
211
|
+
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
212
|
+
---------------------------------------------------------------------------------------------
|
|
213
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
214
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
215
|
+
----------------------------------------------------------------------------------
|
|
216
|
+
ActiveRecordDoctor::Tasks::UndefinedTablesTest: test_undefined_tables_are_reported
|
|
217
|
+
----------------------------------------------------------------------------------
|
|
218
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
219
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
220
|
+
--------------------------------------------------------------------------------------
|
|
221
|
+
ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_reported
|
|
222
|
+
--------------------------------------------------------------------------------------
|
|
223
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
224
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
225
|
+
------------------------------------------------------------------------------
|
|
226
|
+
ActiveRecordDoctor::Printers::IOPrinterTest: test_print_unindexed_foreign_keys
|
|
227
|
+
------------------------------------------------------------------------------
|
|
228
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
229
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
230
|
+
-----------------------------------------------------------------------------------------
|
|
231
|
+
ActiveRecordDoctor::Tasks::MissingForeignKeysTest: test_missing_foreign_keys_are_reported
|
|
232
|
+
-----------------------------------------------------------------------------------------
|
|
233
|
+
[1m[36m (1.6ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
234
|
+
FROM pg_constraint c
|
|
235
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
236
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
237
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
238
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
239
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
240
|
+
WHERE c.contype = 'f'
|
|
241
|
+
AND t1.relname = 'comments'
|
|
242
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
243
|
+
ORDER BY c.conname
|
|
244
|
+
[0m
|
|
245
|
+
[1m[35m (1.1ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
246
|
+
FROM pg_constraint c
|
|
247
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
248
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
249
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
250
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
251
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
252
|
+
WHERE c.contype = 'f'
|
|
253
|
+
AND t1.relname = 'users'
|
|
254
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
255
|
+
ORDER BY c.conname
|
|
256
|
+
|
|
257
|
+
[1m[36m (1.2ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
258
|
+
FROM pg_constraint c
|
|
259
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
260
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
261
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
262
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
263
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
264
|
+
WHERE c.contype = 'f'
|
|
265
|
+
AND t1.relname = 'users'
|
|
266
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
267
|
+
ORDER BY c.conname
|
|
268
|
+
[0m
|
|
269
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
270
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
271
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
272
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
273
|
+
-----------------------------------------------------------------------------------------
|
|
274
|
+
ActiveRecordDoctor::Tasks::MissingForeignKeysTest: test_missing_foreign_keys_are_reported
|
|
275
|
+
-----------------------------------------------------------------------------------------
|
|
276
|
+
[1m[36m (1.4ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
277
|
+
FROM pg_constraint c
|
|
278
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
279
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
280
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
281
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
282
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
283
|
+
WHERE c.contype = 'f'
|
|
284
|
+
AND t1.relname = 'comments'
|
|
285
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
286
|
+
ORDER BY c.conname
|
|
287
|
+
[0m
|
|
288
|
+
[1m[35m (1.1ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
289
|
+
FROM pg_constraint c
|
|
290
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
291
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
292
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
293
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
294
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
295
|
+
WHERE c.contype = 'f'
|
|
296
|
+
AND t1.relname = 'users'
|
|
297
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
298
|
+
ORDER BY c.conname
|
|
299
|
+
|
|
300
|
+
[1m[36m (1.2ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
301
|
+
FROM pg_constraint c
|
|
302
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
303
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
304
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
305
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
306
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
307
|
+
WHERE c.contype = 'f'
|
|
308
|
+
AND t1.relname = 'users'
|
|
309
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
310
|
+
ORDER BY c.conname
|
|
311
|
+
[0m
|
|
312
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
313
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
314
|
+
------------------------------------------------------------------------------
|
|
315
|
+
ActiveRecordDoctor::Printers::IOPrinterTest: test_print_unindexed_foreign_keys
|
|
316
|
+
------------------------------------------------------------------------------
|
|
317
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
318
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
319
|
+
-----------------------------------------------------------------------------------------------------
|
|
320
|
+
ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest: test_undefined_table_references_are_reported
|
|
321
|
+
-----------------------------------------------------------------------------------------------------
|
|
322
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
323
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
324
|
+
--------------------------------------------------------------------------------------
|
|
325
|
+
ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_reported
|
|
326
|
+
--------------------------------------------------------------------------------------
|
|
327
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
328
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
329
|
+
---------------------------------------------------------------------------------------------
|
|
330
|
+
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
331
|
+
---------------------------------------------------------------------------------------------
|
|
332
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
333
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
334
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
335
|
+
------------------------------------------------------------------------------
|
|
336
|
+
ActiveRecordDoctor::Printers::IOPrinterTest: test_print_unindexed_foreign_keys
|
|
337
|
+
------------------------------------------------------------------------------
|
|
338
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
339
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
340
|
+
-----------------------------------------------------------------------------------------------------
|
|
341
|
+
ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest: test_undefined_table_references_are_reported
|
|
342
|
+
-----------------------------------------------------------------------------------------------------
|
|
343
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
344
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
345
|
+
--------------------------------------------------------------------------------------
|
|
346
|
+
ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_reported
|
|
347
|
+
--------------------------------------------------------------------------------------
|
|
348
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
349
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
350
|
+
-----------------------------------------------------------------------------------------
|
|
351
|
+
ActiveRecordDoctor::Tasks::MissingForeignKeysTest: test_missing_foreign_keys_are_reported
|
|
352
|
+
-----------------------------------------------------------------------------------------
|
|
353
|
+
[1m[36m (1.3ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
354
|
+
FROM pg_constraint c
|
|
355
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
356
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
357
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
358
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
359
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
360
|
+
WHERE c.contype = 'f'
|
|
361
|
+
AND t1.relname = 'comments'
|
|
362
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
363
|
+
ORDER BY c.conname
|
|
364
|
+
[0m
|
|
365
|
+
[1m[35m (1.1ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
366
|
+
FROM pg_constraint c
|
|
367
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
368
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
369
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
370
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
371
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
372
|
+
WHERE c.contype = 'f'
|
|
373
|
+
AND t1.relname = 'users'
|
|
374
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
375
|
+
ORDER BY c.conname
|
|
376
|
+
|
|
377
|
+
[1m[36m (1.2ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
378
|
+
FROM pg_constraint c
|
|
379
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
380
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
381
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
382
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
383
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
384
|
+
WHERE c.contype = 'f'
|
|
385
|
+
AND t1.relname = 'users'
|
|
386
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
387
|
+
ORDER BY c.conname
|
|
388
|
+
[0m
|
|
389
|
+
[1m[35m (0.2ms)[0m ROLLBACK
|
|
390
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
391
|
+
---------------------------------------------------------------------------------------------
|
|
392
|
+
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
393
|
+
---------------------------------------------------------------------------------------------
|
|
394
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
395
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
396
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
397
|
+
------------------------------------------------------------------------------
|
|
398
|
+
ActiveRecordDoctor::Printers::IOPrinterTest: test_print_unindexed_foreign_keys
|
|
399
|
+
------------------------------------------------------------------------------
|
|
400
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
401
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
402
|
+
-----------------------------------------------------------------------------------------
|
|
403
|
+
ActiveRecordDoctor::Tasks::MissingForeignKeysTest: test_missing_foreign_keys_are_reported
|
|
404
|
+
-----------------------------------------------------------------------------------------
|
|
405
|
+
[1m[36m (1.4ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
406
|
+
FROM pg_constraint c
|
|
407
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
408
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
409
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
410
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
411
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
412
|
+
WHERE c.contype = 'f'
|
|
413
|
+
AND t1.relname = 'comments'
|
|
414
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
415
|
+
ORDER BY c.conname
|
|
416
|
+
[0m
|
|
417
|
+
[1m[35m (1.2ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
418
|
+
FROM pg_constraint c
|
|
419
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
420
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
421
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
422
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
423
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
424
|
+
WHERE c.contype = 'f'
|
|
425
|
+
AND t1.relname = 'users'
|
|
426
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
427
|
+
ORDER BY c.conname
|
|
428
|
+
|
|
429
|
+
[1m[36m (1.2ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
430
|
+
FROM pg_constraint c
|
|
431
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
432
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
433
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
434
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
435
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
436
|
+
WHERE c.contype = 'f'
|
|
437
|
+
AND t1.relname = 'users'
|
|
438
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
439
|
+
ORDER BY c.conname
|
|
440
|
+
[0m
|
|
441
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
442
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
443
|
+
-----------------------------------------------------------------------------------------------------
|
|
444
|
+
ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest: test_undefined_table_references_are_reported
|
|
445
|
+
-----------------------------------------------------------------------------------------------------
|
|
446
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
447
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
448
|
+
---------------------------------------------------------------------------------------------
|
|
449
|
+
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
450
|
+
---------------------------------------------------------------------------------------------
|
|
451
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
452
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
453
|
+
--------------------------------------------------------------------------------------
|
|
454
|
+
ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_reported
|
|
455
|
+
--------------------------------------------------------------------------------------
|
|
456
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
457
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
458
|
+
[1m[35m (0.2ms)[0m BEGIN
|
|
459
|
+
---------------------------------------------------------------------------------------------
|
|
460
|
+
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
461
|
+
---------------------------------------------------------------------------------------------
|
|
462
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
463
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
464
|
+
------------------------------------------------------------------------------
|
|
465
|
+
ActiveRecordDoctor::Printers::IOPrinterTest: test_print_unindexed_foreign_keys
|
|
466
|
+
------------------------------------------------------------------------------
|
|
467
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
468
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
469
|
+
-----------------------------------------------------------------------------------------------------
|
|
470
|
+
ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest: test_undefined_table_references_are_reported
|
|
471
|
+
-----------------------------------------------------------------------------------------------------
|
|
472
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
473
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
474
|
+
-----------------------------------------------------------------------------------------
|
|
475
|
+
ActiveRecordDoctor::Tasks::MissingForeignKeysTest: test_missing_foreign_keys_are_reported
|
|
476
|
+
-----------------------------------------------------------------------------------------
|
|
477
|
+
[1m[36m (1.4ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
478
|
+
FROM pg_constraint c
|
|
479
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
480
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
481
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
482
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
483
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
484
|
+
WHERE c.contype = 'f'
|
|
485
|
+
AND t1.relname = 'comments'
|
|
486
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
487
|
+
ORDER BY c.conname
|
|
488
|
+
[0m
|
|
489
|
+
[1m[35m (1.1ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
490
|
+
FROM pg_constraint c
|
|
491
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
492
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
493
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
494
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
495
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
496
|
+
WHERE c.contype = 'f'
|
|
497
|
+
AND t1.relname = 'users'
|
|
498
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
499
|
+
ORDER BY c.conname
|
|
500
|
+
|
|
501
|
+
[1m[36m (1.2ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
502
|
+
FROM pg_constraint c
|
|
503
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
504
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
505
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
506
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
507
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
508
|
+
WHERE c.contype = 'f'
|
|
509
|
+
AND t1.relname = 'users'
|
|
510
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
511
|
+
ORDER BY c.conname
|
|
512
|
+
[0m
|
|
513
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
514
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
515
|
+
--------------------------------------------------------------------------------------
|
|
516
|
+
ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_reported
|
|
517
|
+
--------------------------------------------------------------------------------------
|
|
518
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
519
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
520
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
521
|
+
---------------------------------------------------------------------------------------------
|
|
522
|
+
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
523
|
+
---------------------------------------------------------------------------------------------
|
|
524
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
525
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
526
|
+
------------------------------------------------------------------------------
|
|
527
|
+
ActiveRecordDoctor::Printers::IOPrinterTest: test_print_unindexed_foreign_keys
|
|
528
|
+
------------------------------------------------------------------------------
|
|
529
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
530
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
531
|
+
-----------------------------------------------------------------------------------------------------
|
|
532
|
+
ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest: test_undefined_table_references_are_reported
|
|
533
|
+
-----------------------------------------------------------------------------------------------------
|
|
534
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
535
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
536
|
+
--------------------------------------------------------------------------------------
|
|
537
|
+
ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_reported
|
|
538
|
+
--------------------------------------------------------------------------------------
|
|
539
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
540
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
541
|
+
-----------------------------------------------------------------------------------------
|
|
542
|
+
ActiveRecordDoctor::Tasks::MissingForeignKeysTest: test_missing_foreign_keys_are_reported
|
|
543
|
+
-----------------------------------------------------------------------------------------
|
|
544
|
+
[1m[36m (1.4ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
545
|
+
FROM pg_constraint c
|
|
546
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
547
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
548
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
549
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
550
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
551
|
+
WHERE c.contype = 'f'
|
|
552
|
+
AND t1.relname = 'comments'
|
|
553
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
554
|
+
ORDER BY c.conname
|
|
555
|
+
[0m
|
|
556
|
+
[1m[35m (1.1ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
557
|
+
FROM pg_constraint c
|
|
558
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
559
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
560
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
561
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
562
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
563
|
+
WHERE c.contype = 'f'
|
|
564
|
+
AND t1.relname = 'users'
|
|
565
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
566
|
+
ORDER BY c.conname
|
|
567
|
+
|
|
568
|
+
[1m[36m (1.2ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
569
|
+
FROM pg_constraint c
|
|
570
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
571
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
572
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
573
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
574
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
575
|
+
WHERE c.contype = 'f'
|
|
576
|
+
AND t1.relname = 'users'
|
|
577
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
578
|
+
ORDER BY c.conname
|
|
579
|
+
[0m
|
|
580
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
581
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
582
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
583
|
+
------------------------------------------------------------------------------
|
|
584
|
+
ActiveRecordDoctor::Printers::IOPrinterTest: test_print_unindexed_foreign_keys
|
|
585
|
+
------------------------------------------------------------------------------
|
|
586
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
587
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
588
|
+
--------------------------------------------------------------------------------------
|
|
589
|
+
ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_reported
|
|
590
|
+
--------------------------------------------------------------------------------------
|
|
591
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
592
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
593
|
+
---------------------------------------------------------------------------------------------
|
|
594
|
+
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
595
|
+
---------------------------------------------------------------------------------------------
|
|
596
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
597
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
598
|
+
-----------------------------------------------------------------------------------------------------
|
|
599
|
+
ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest: test_undefined_table_references_are_reported
|
|
600
|
+
-----------------------------------------------------------------------------------------------------
|
|
601
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
602
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
603
|
+
-----------------------------------------------------------------------------------------
|
|
604
|
+
ActiveRecordDoctor::Tasks::MissingForeignKeysTest: test_missing_foreign_keys_are_reported
|
|
605
|
+
-----------------------------------------------------------------------------------------
|
|
606
|
+
[1m[36m (1.4ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
607
|
+
FROM pg_constraint c
|
|
608
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
609
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
610
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
611
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
612
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
613
|
+
WHERE c.contype = 'f'
|
|
614
|
+
AND t1.relname = 'comments'
|
|
615
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
616
|
+
ORDER BY c.conname
|
|
617
|
+
[0m
|
|
618
|
+
[1m[35m (1.1ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
619
|
+
FROM pg_constraint c
|
|
620
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
621
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
622
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
623
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
624
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
625
|
+
WHERE c.contype = 'f'
|
|
626
|
+
AND t1.relname = 'users'
|
|
627
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
628
|
+
ORDER BY c.conname
|
|
629
|
+
|
|
630
|
+
[1m[36m (1.1ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
631
|
+
FROM pg_constraint c
|
|
632
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
633
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
634
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
635
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
636
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
637
|
+
WHERE c.contype = 'f'
|
|
638
|
+
AND t1.relname = 'users'
|
|
639
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
640
|
+
ORDER BY c.conname
|
|
641
|
+
[0m
|
|
642
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
643
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
644
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
645
|
+
-----------------------------------------------------------------------------------------
|
|
646
|
+
ActiveRecordDoctor::Tasks::MissingForeignKeysTest: test_missing_foreign_keys_are_reported
|
|
647
|
+
-----------------------------------------------------------------------------------------
|
|
648
|
+
[1m[36m (1.5ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
649
|
+
FROM pg_constraint c
|
|
650
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
651
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
652
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
653
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
654
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
655
|
+
WHERE c.contype = 'f'
|
|
656
|
+
AND t1.relname = 'comments'
|
|
657
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
658
|
+
ORDER BY c.conname
|
|
659
|
+
[0m
|
|
660
|
+
[1m[35m (1.2ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
661
|
+
FROM pg_constraint c
|
|
662
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
663
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
664
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
665
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
666
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
667
|
+
WHERE c.contype = 'f'
|
|
668
|
+
AND t1.relname = 'users'
|
|
669
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
670
|
+
ORDER BY c.conname
|
|
671
|
+
|
|
672
|
+
[1m[36m (1.2ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
673
|
+
FROM pg_constraint c
|
|
674
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
675
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
676
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
677
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
678
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
679
|
+
WHERE c.contype = 'f'
|
|
680
|
+
AND t1.relname = 'users'
|
|
681
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
682
|
+
ORDER BY c.conname
|
|
683
|
+
[0m
|
|
684
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
685
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
686
|
+
------------------------------------------------------------------------------
|
|
687
|
+
ActiveRecordDoctor::Printers::IOPrinterTest: test_print_unindexed_foreign_keys
|
|
688
|
+
------------------------------------------------------------------------------
|
|
689
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
690
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
691
|
+
--------------------------------------------------------------------------------------
|
|
692
|
+
ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_reported
|
|
693
|
+
--------------------------------------------------------------------------------------
|
|
694
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
695
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
696
|
+
-----------------------------------------------------------------------------------------------------
|
|
697
|
+
ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest: test_undefined_table_references_are_reported
|
|
698
|
+
-----------------------------------------------------------------------------------------------------
|
|
699
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
700
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
701
|
+
---------------------------------------------------------------------------------------------
|
|
702
|
+
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
703
|
+
---------------------------------------------------------------------------------------------
|
|
704
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
705
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
706
|
+
[1m[35m (0.2ms)[0m BEGIN
|
|
707
|
+
-----------------------------------------------------------------------------------------
|
|
708
|
+
ActiveRecordDoctor::Tasks::MissingForeignKeysTest: test_missing_foreign_keys_are_reported
|
|
709
|
+
-----------------------------------------------------------------------------------------
|
|
710
|
+
[1m[36m (1.5ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
711
|
+
FROM pg_constraint c
|
|
712
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
713
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
714
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
715
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
716
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
717
|
+
WHERE c.contype = 'f'
|
|
718
|
+
AND t1.relname = 'comments'
|
|
719
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
720
|
+
ORDER BY c.conname
|
|
721
|
+
[0m
|
|
722
|
+
[1m[35m (1.1ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
723
|
+
FROM pg_constraint c
|
|
724
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
725
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
726
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
727
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
728
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
729
|
+
WHERE c.contype = 'f'
|
|
730
|
+
AND t1.relname = 'users'
|
|
731
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
732
|
+
ORDER BY c.conname
|
|
733
|
+
|
|
734
|
+
[1m[36m (1.2ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
735
|
+
FROM pg_constraint c
|
|
736
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
737
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
738
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
739
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
740
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
741
|
+
WHERE c.contype = 'f'
|
|
742
|
+
AND t1.relname = 'users'
|
|
743
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
744
|
+
ORDER BY c.conname
|
|
745
|
+
[0m
|
|
746
|
+
[1m[35m (0.2ms)[0m ROLLBACK
|
|
747
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
748
|
+
-----------------------------------------------------------------------------------------------------
|
|
749
|
+
ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest: test_undefined_table_references_are_reported
|
|
750
|
+
-----------------------------------------------------------------------------------------------------
|
|
751
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
752
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
753
|
+
--------------------------------------------------------------------------------------
|
|
754
|
+
ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_reported
|
|
755
|
+
--------------------------------------------------------------------------------------
|
|
756
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
757
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
758
|
+
---------------------------------------------------------------------------------------------
|
|
759
|
+
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
760
|
+
---------------------------------------------------------------------------------------------
|
|
761
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
762
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
763
|
+
------------------------------------------------------------------------------
|
|
764
|
+
ActiveRecordDoctor::Printers::IOPrinterTest: test_print_unindexed_foreign_keys
|
|
765
|
+
------------------------------------------------------------------------------
|
|
766
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
|
767
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.2ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
768
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
769
|
+
---------------------------------------------------------------------------------------------
|
|
770
|
+
ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest: test_unindexed_foreign_keys_are_reported
|
|
771
|
+
---------------------------------------------------------------------------------------------
|
|
772
|
+
[1m[36m (0.0ms)[0m [1mROLLBACK[0m
|
|
773
|
+
[1m[35m (0.0ms)[0m BEGIN
|
|
774
|
+
-----------------------------------------------------------------------------------------------------
|
|
775
|
+
ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest: test_undefined_table_references_are_reported
|
|
776
|
+
-----------------------------------------------------------------------------------------------------
|
|
777
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
|
778
|
+
[1m[35m (0.1ms)[0m BEGIN
|
|
779
|
+
-----------------------------------------------------------------------------------------
|
|
780
|
+
ActiveRecordDoctor::Tasks::MissingForeignKeysTest: test_missing_foreign_keys_are_reported
|
|
781
|
+
-----------------------------------------------------------------------------------------
|
|
782
|
+
[1m[36m (1.3ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
783
|
+
FROM pg_constraint c
|
|
784
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
785
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
786
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
787
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
788
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
789
|
+
WHERE c.contype = 'f'
|
|
790
|
+
AND t1.relname = 'comments'
|
|
791
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
792
|
+
ORDER BY c.conname
|
|
793
|
+
[0m
|
|
794
|
+
[1m[35m (1.1ms)[0m SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
795
|
+
FROM pg_constraint c
|
|
796
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
797
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
798
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
799
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
800
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
801
|
+
WHERE c.contype = 'f'
|
|
802
|
+
AND t1.relname = 'users'
|
|
803
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
804
|
+
ORDER BY c.conname
|
|
805
|
+
|
|
806
|
+
[1m[36m (1.2ms)[0m [1mSELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
|
|
807
|
+
FROM pg_constraint c
|
|
808
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
|
809
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
|
810
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
|
811
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
|
812
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
|
813
|
+
WHERE c.contype = 'f'
|
|
814
|
+
AND t1.relname = 'users'
|
|
815
|
+
AND t3.nspname = ANY (current_schemas(false))
|
|
816
|
+
ORDER BY c.conname
|
|
817
|
+
[0m
|
|
818
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
819
|
+
[1m[36m (0.0ms)[0m [1mBEGIN[0m
|
|
820
|
+
------------------------------------------------------------------------------
|
|
821
|
+
ActiveRecordDoctor::Printers::IOPrinterTest: test_print_unindexed_foreign_keys
|
|
822
|
+
------------------------------------------------------------------------------
|
|
823
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
|
824
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
|
825
|
+
--------------------------------------------------------------------------------------
|
|
826
|
+
ActiveRecordDoctor::Tasks::ExtraneousIndexesTest: test_extraneous_indexes_are_reported
|
|
827
|
+
--------------------------------------------------------------------------------------
|
|
828
|
+
[1m[35m (0.0ms)[0m ROLLBACK
|
data/test/support/spy_printer.rb
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
class SpyPrinter
|
|
2
2
|
attr_reader :unindexed_foreign_keys, :extraneous_indexes,
|
|
3
|
-
:missing_foreign_keys
|
|
3
|
+
:missing_foreign_keys, :undefined_table_references
|
|
4
4
|
|
|
5
5
|
def initialize
|
|
6
6
|
@unindexed_foreign_keys = nil
|
|
7
7
|
@extraneous_indexes = nil
|
|
8
8
|
@missing_foreign_keys = nil
|
|
9
|
+
@undefined_table_references = nil
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def print_unindexed_foreign_keys(argument)
|
|
@@ -31,4 +32,12 @@ class SpyPrinter
|
|
|
31
32
|
@missing_foreign_keys = argument
|
|
32
33
|
end
|
|
33
34
|
end
|
|
35
|
+
|
|
36
|
+
def print_undefined_table_references(argument)
|
|
37
|
+
if @undefined_table_references
|
|
38
|
+
fail("print_undefined_table_references cannot be called twice")
|
|
39
|
+
else
|
|
40
|
+
@undefined_table_references = argument
|
|
41
|
+
end
|
|
42
|
+
end
|
|
34
43
|
end
|
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.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Greg Navis
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-07-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: railties
|
|
@@ -84,6 +84,7 @@ files:
|
|
|
84
84
|
- lib/active_record_doctor/tasks.rb
|
|
85
85
|
- lib/active_record_doctor/tasks/extraneous_indexes.rb
|
|
86
86
|
- lib/active_record_doctor/tasks/missing_foreign_keys.rb
|
|
87
|
+
- lib/active_record_doctor/tasks/undefined_table_references.rb
|
|
87
88
|
- lib/active_record_doctor/tasks/unindexed_foreign_keys.rb
|
|
88
89
|
- lib/active_record_doctor/version.rb
|
|
89
90
|
- lib/generators/active_record_doctor/add_indexes/USAGE
|
|
@@ -92,6 +93,7 @@ files:
|
|
|
92
93
|
- test/active_record_doctor/printers/io_printer_test.rb
|
|
93
94
|
- test/active_record_doctor/tasks/extraneous_indexes_test.rb
|
|
94
95
|
- test/active_record_doctor/tasks/missing_foreign_keys_test.rb
|
|
96
|
+
- test/active_record_doctor/tasks/undefined_table_references_test.rb
|
|
95
97
|
- test/active_record_doctor/tasks/unindexed_foreign_keys_test.rb
|
|
96
98
|
- test/dummy/README.rdoc
|
|
97
99
|
- test/dummy/Rakefile
|
|
@@ -100,6 +102,7 @@ files:
|
|
|
100
102
|
- test/dummy/app/controllers/application_controller.rb
|
|
101
103
|
- test/dummy/app/helpers/application_helper.rb
|
|
102
104
|
- test/dummy/app/models/comment.rb
|
|
105
|
+
- test/dummy/app/models/contract.rb
|
|
103
106
|
- test/dummy/app/models/employer.rb
|
|
104
107
|
- test/dummy/app/models/profile.rb
|
|
105
108
|
- test/dummy/app/models/user.rb
|
|
@@ -171,6 +174,7 @@ test_files:
|
|
|
171
174
|
- test/active_record_doctor/printers/io_printer_test.rb
|
|
172
175
|
- test/active_record_doctor/tasks/missing_foreign_keys_test.rb
|
|
173
176
|
- test/active_record_doctor/tasks/extraneous_indexes_test.rb
|
|
177
|
+
- test/active_record_doctor/tasks/undefined_table_references_test.rb
|
|
174
178
|
- test/active_record_doctor/tasks/unindexed_foreign_keys_test.rb
|
|
175
179
|
- test/dummy/README.rdoc
|
|
176
180
|
- test/dummy/log/development.log
|
|
@@ -186,6 +190,7 @@ test_files:
|
|
|
186
190
|
- test/dummy/app/views/layouts/application.html.erb
|
|
187
191
|
- test/dummy/app/models/profile.rb
|
|
188
192
|
- test/dummy/app/models/comment.rb
|
|
193
|
+
- test/dummy/app/models/contract.rb
|
|
189
194
|
- test/dummy/app/models/employer.rb
|
|
190
195
|
- test/dummy/app/models/user.rb
|
|
191
196
|
- test/dummy/db/schema.rb
|