active_record_doctor 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +73 -6
  3. data/lib/active_record_doctor/printers/io_printer.rb +35 -6
  4. data/lib/active_record_doctor/railtie.rb +1 -1
  5. data/lib/active_record_doctor/tasks.rb +3 -0
  6. data/lib/active_record_doctor/tasks/base.rb +64 -0
  7. data/lib/active_record_doctor/tasks/extraneous_indexes.rb +4 -27
  8. data/lib/active_record_doctor/tasks/missing_foreign_keys.rb +6 -29
  9. data/lib/active_record_doctor/tasks/missing_non_null_constraint.rb +42 -0
  10. data/lib/active_record_doctor/tasks/missing_presence_validation.rb +39 -0
  11. data/lib/active_record_doctor/tasks/missing_unique_indexes.rb +51 -0
  12. data/lib/active_record_doctor/tasks/undefined_table_references.rb +6 -22
  13. data/lib/active_record_doctor/tasks/unindexed_deleted_at.rb +4 -25
  14. data/lib/active_record_doctor/tasks/unindexed_foreign_keys.rb +6 -29
  15. data/lib/active_record_doctor/version.rb +1 -1
  16. data/lib/tasks/active_record_doctor.rake +31 -0
  17. data/test/active_record_doctor/printers/io_printer_test.rb +4 -4
  18. data/test/active_record_doctor/tasks/extraneous_indexes_test.rb +70 -16
  19. data/test/active_record_doctor/tasks/missing_foreign_keys_test.rb +16 -8
  20. data/test/active_record_doctor/tasks/missing_non_null_constraint_test.rb +89 -0
  21. data/test/active_record_doctor/tasks/missing_presence_validation_test.rb +49 -0
  22. data/test/active_record_doctor/tasks/missing_unique_indexes_test.rb +95 -0
  23. data/test/active_record_doctor/tasks/unindexed_deleted_at_test.rb +23 -8
  24. data/test/active_record_doctor/tasks/unindexed_foreign_keys_test.rb +16 -8
  25. data/test/dummy/app/models/application_record.rb +1 -1
  26. data/test/dummy/db/schema.rb +1 -50
  27. data/test/dummy/log/development.log +38 -498
  28. data/test/dummy/log/test.log +54108 -1571
  29. data/test/support/assertions.rb +11 -0
  30. data/test/support/forking_test.rb +28 -0
  31. data/test/support/temping.rb +25 -0
  32. data/test/test_helper.rb +0 -7
  33. metadata +34 -27
  34. data/lib/active_record_doctor/compatibility.rb +0 -11
  35. data/lib/tasks/active_record_doctor_tasks.rake +0 -27
  36. data/test/active_record_doctor/tasks/undefined_table_references_test.rb +0 -19
  37. data/test/dummy/app/models/comment.rb +0 -3
  38. data/test/dummy/app/models/contract.rb +0 -3
  39. data/test/dummy/app/models/employer.rb +0 -2
  40. data/test/dummy/app/models/profile.rb +0 -2
  41. data/test/dummy/app/models/user.rb +0 -3
  42. data/test/dummy/db/migrate/20160213101213_create_employers.rb +0 -15
  43. data/test/dummy/db/migrate/20160213101221_create_users.rb +0 -23
  44. data/test/dummy/db/migrate/20160213101232_create_profiles.rb +0 -15
  45. data/test/dummy/db/migrate/20160604081452_create_comments.rb +0 -11
  46. data/test/support/spy_printer.rb +0 -52
@@ -0,0 +1,49 @@
1
+ require 'test_helper'
2
+
3
+ require 'active_record_doctor/tasks/missing_presence_validation'
4
+
5
+ class ActiveRecordDoctor::Tasks::MissingPresenceValidationTest < ActiveSupport::TestCase
6
+ def test_null_column_is_not_reported_if_validation_absent
7
+ Temping.create(:users, temporary: false) do
8
+ with_columns do |t|
9
+ t.string :name
10
+ end
11
+ end
12
+
13
+ assert_equal({}, run_task)
14
+ end
15
+
16
+ def test_non_null_column_is_reported_if_validation_absent
17
+ Temping.create(:users, temporary: false) do
18
+ with_columns do |t|
19
+ t.string :name, null: false
20
+ end
21
+ end
22
+
23
+ assert_equal({ 'User' => ['name'] }, run_task)
24
+ end
25
+
26
+ def test_non_null_column_is_not_reported_if_validation_present
27
+ Temping.create(:users, temporary: false) do
28
+ validates :name, presence: true
29
+
30
+ with_columns do |t|
31
+ t.string :name, null: false
32
+ end
33
+ end
34
+
35
+ assert_equal({}, run_task)
36
+ end
37
+
38
+ def test_timestamps_are_not_reported
39
+ Temping.create(:users, temporary: false) do
40
+ validates :name, presence: true
41
+
42
+ with_columns do |t|
43
+ t.timestamps null: false
44
+ end
45
+ end
46
+
47
+ assert_equal({}, run_task)
48
+ end
49
+ end
@@ -0,0 +1,95 @@
1
+ require 'test_helper'
2
+
3
+ require 'active_record_doctor/tasks/missing_unique_indexes'
4
+
5
+ class ActiveRecordDoctor::Tasks::MissingUniqueIndexesTest < ActiveSupport::TestCase
6
+ def test_missing_unique_index
7
+ Temping.create(:users, temporary: false) do
8
+ with_columns do |t|
9
+ t.string :email
10
+ t.index :email
11
+ end
12
+
13
+ validates :email, uniqueness: true
14
+ end
15
+
16
+ assert_result([
17
+ ['users', [['email']]]
18
+ ])
19
+ end
20
+
21
+ def test_present_unique_index
22
+ Temping.create(:users, temporary: false) do
23
+ with_columns do |t|
24
+ t.string :email
25
+ t.index :email, unique: true
26
+ end
27
+
28
+ validates :email, uniqueness: true
29
+ end
30
+
31
+ assert_result([])
32
+ end
33
+
34
+ def test_missing_unique_index_with_scope
35
+ Temping.create(:users, temporary: false) do
36
+ with_columns do |t|
37
+ t.string :email
38
+ t.integer :company_id
39
+ t.integer :department_id
40
+ t.index [:company_id, :department_id, :email]
41
+ end
42
+
43
+ validates :email, uniqueness: { scope: [:company_id, :department_id] }
44
+ end
45
+
46
+ assert_result([
47
+ ['users', [['company_id', 'department_id', 'email']]]
48
+ ])
49
+ end
50
+
51
+ def test_present_unique_index_with_scope
52
+ Temping.create(:users, temporary: false) do
53
+ with_columns do |t|
54
+ t.string :email
55
+ t.integer :company_id
56
+ t.integer :department_id
57
+ t.index [:company_id, :department_id, :email], unique: true
58
+ end
59
+
60
+ validates :email, uniqueness: { scope: [:company_id, :department_id] }
61
+ end
62
+
63
+ assert_result([])
64
+ end
65
+
66
+ def test_conditions_is_skipped
67
+ assert_skipped(conditions: -> { where.not(email: nil) })
68
+ end
69
+
70
+ def test_case_insensitive_is_skipped
71
+ assert_skipped(case_sensitive: false)
72
+ end
73
+
74
+ def test_if_is_skipped
75
+ assert_skipped(if: ->(model) { true })
76
+ end
77
+
78
+ def test_unless_is_skipped
79
+ assert_skipped(unless: ->(model) { true })
80
+ end
81
+
82
+ private
83
+
84
+ def assert_skipped(options)
85
+ Temping.create(:users, temporary: false) do
86
+ with_columns do |t|
87
+ t.string :email
88
+ end
89
+
90
+ validates :email, uniqueness: options
91
+ end
92
+
93
+ assert_result([])
94
+ end
95
+ end
@@ -3,17 +3,32 @@ require 'test_helper'
3
3
  require 'active_record_doctor/tasks/unindexed_deleted_at'
4
4
 
5
5
  class ActiveRecordDoctor::Tasks::UnindexedDeletedAtTest < ActiveSupport::TestCase
6
- def test_unindexed_deleted_at_are_reported
7
- result = run_task
6
+ def test_indexed_deleted_at_is_not_reported
7
+ Temping.create(:users, temporary: false) do
8
+ with_columns do |t|
9
+ t.string :first_name
10
+ t.string :last_name
11
+ t.datetime :deleted_at
12
+ t.index [:first_name, :last_name],
13
+ name: 'index_profiles_on_first_name_and_last_name',
14
+ where: 'deleted_at IS NULL'
15
+ end
16
+ end
8
17
 
9
- assert_equal(['index_profiles_on_first_name_and_last_name'], result)
18
+ assert_result([])
10
19
  end
11
20
 
12
- private
21
+ def test_unindexed_deleted_at_is_reported
22
+ Temping.create(:users, temporary: false) do
23
+ with_columns do |t|
24
+ t.string :first_name
25
+ t.string :last_name
26
+ t.datetime :deleted_at
27
+ t.index [:first_name, :last_name],
28
+ name: 'index_profiles_on_first_name_and_last_name'
29
+ end
30
+ end
13
31
 
14
- def run_task
15
- printer = SpyPrinter.new
16
- ActiveRecordDoctor::Tasks::UnindexedDeletedAt.new(printer: printer).run
17
- printer.unindexed_deleted_at
32
+ assert_result(['index_profiles_on_first_name_and_last_name'])
18
33
  end
19
34
  end
@@ -3,17 +3,25 @@ require 'test_helper'
3
3
  require 'active_record_doctor/tasks/unindexed_foreign_keys'
4
4
 
5
5
  class ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest < ActiveSupport::TestCase
6
- def test_unindexed_foreign_keys_are_reported
7
- result = run_task
6
+ def test_unindexed_foreign_key_is_reported
7
+ Temping.create(:companies, temporary: false)
8
+ Temping.create(:users, temporary: false) do
9
+ with_columns do |t|
10
+ t.references :company, foreign_key: true, index: false
11
+ end
12
+ end
8
13
 
9
- assert_equal({ "users" => ["profile_id"] }, result)
14
+ assert_equal({'users' => ['company_id']}, run_task)
10
15
  end
11
16
 
12
- private
17
+ def test_indexed_foreign_key_is_not_reported
18
+ Temping.create(:companies, temporary: false)
19
+ Temping.create(:users, temporary: false) do
20
+ with_columns do |t|
21
+ t.references :company, foreign_key: true, index: true
22
+ end
23
+ end
13
24
 
14
- def run_task
15
- printer = SpyPrinter.new
16
- ActiveRecordDoctor::Tasks::UnindexedForeignKeys.new(printer: printer).run
17
- printer.unindexed_foreign_keys
25
+ assert_equal({}, run_task)
18
26
  end
19
27
  end
@@ -1,3 +1,3 @@
1
1
  class ApplicationRecord < ActiveRecord::Base
2
- self.table_name = nil
2
+ self.abstract_class = true
3
3
  end
@@ -11,58 +11,9 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20160604081452) do
14
+ ActiveRecord::Schema.define(version: 0) do
15
15
 
16
16
  # These are extensions that must be enabled in order to support this database
17
17
  enable_extension "plpgsql"
18
18
 
19
- create_table "comments", force: :cascade do |t|
20
- t.integer "commentable_id"
21
- t.string "commentable_type"
22
- t.datetime "created_at", null: false
23
- t.datetime "updated_at", null: false
24
- end
25
-
26
- add_index "comments", ["commentable_type", "commentable_id"], name: "index_comments_on_commentable_type_and_commentable_id", using: :btree
27
-
28
- create_table "employers", force: :cascade do |t|
29
- t.string "name"
30
- t.datetime "deleted_at"
31
- t.datetime "created_at", null: false
32
- t.datetime "updated_at", null: false
33
- end
34
-
35
- add_index "employers", ["id"], name: "index_employers_on_id", where: "(deleted_at IS NULL)", using: :btree
36
- add_index "employers", ["name"], name: "index_employers_on_name", where: "(deleted_at IS NULL)", using: :btree
37
-
38
- create_table "profiles", force: :cascade do |t|
39
- t.string "first_name"
40
- t.string "last_name"
41
- t.datetime "deleted_at"
42
- t.datetime "created_at", null: false
43
- t.datetime "updated_at", null: false
44
- end
45
-
46
- add_index "profiles", ["first_name", "last_name"], name: "index_profiles_on_first_name_and_last_name", using: :btree
47
-
48
- create_table "users", force: :cascade do |t|
49
- t.string "email"
50
- t.string "first_name"
51
- t.string "last_name"
52
- t.integer "profile_id"
53
- t.integer "employer_id"
54
- t.string "country_code", null: false
55
- t.datetime "created_at", null: false
56
- t.datetime "updated_at", null: false
57
- end
58
-
59
- add_index "users", ["email"], name: "index_users_on_email", using: :btree
60
- add_index "users", ["email"], name: "unique_index_on_users_email", unique: true, using: :btree
61
- add_index "users", ["employer_id", "country_code"], name: "index_users_on_employer_id_and_country_code", using: :btree
62
- add_index "users", ["last_name", "first_name", "email"], name: "index_users_on_last_name_and_first_name_and_email", using: :btree
63
- add_index "users", ["last_name", "first_name"], name: "index_users_on_last_name_and_first_name", using: :btree
64
- add_index "users", ["last_name", "first_name"], name: "unique_index_on_users_last_name_and_first_name", unique: true, using: :btree
65
- add_index "users", ["last_name"], name: "index_users_on_last_name", using: :btree
66
-
67
- add_foreign_key "users", "employers"
68
19
  end
@@ -1,500 +1,34 @@
1
-  (25.1ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
2
-  (19.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
1
+  (30.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
2
+  (34.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
3
  ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4
- Migrating to CreateEmployers (20160213101213)
5
-  (0.1ms) BEGIN
6
-  (35.9ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
7
-  (10.4ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
8
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101213"]]
9
-  (8.4ms) COMMIT
10
- Migrating to CreateUsers (20160213101221)
11
-  (0.1ms) BEGIN
12
-  (35.2ms) CREATE 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)
13
-  (1.0ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
14
- FOREIGN KEY ("employer_id")
15
- REFERENCES "employers" ("id")
16
- 
17
-  (10.4ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
18
-  (4.4ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
19
-  (19.2ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
20
-  (15.8ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
21
-  (10.1ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
22
-  (10.7ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
23
-  (17.0ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
24
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101221"]]
25
-  (7.6ms) COMMIT
26
- Migrating to CreateProfiles (20160213101232)
27
-  (0.1ms) BEGIN
28
-  (21.0ms) 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)
29
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
30
-  (8.0ms) COMMIT
31
- Migrating to CreateComments (20160604081452)
32
-  (0.1ms) BEGIN
33
-  (37.1ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
34
-  (9.9ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
35
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
36
-  (7.9ms) COMMIT
37
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
38
-  (1.4ms) 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
39
- FROM pg_constraint c
40
- JOIN pg_class t1 ON c.conrelid = t1.oid
41
- JOIN pg_class t2 ON c.confrelid = t2.oid
42
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
43
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
44
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
45
- WHERE c.contype = 'f'
46
- AND t1.relname = 'comments'
47
- AND t3.nspname = ANY (current_schemas(false))
48
- ORDER BY c.conname
49
- 
50
-  (1.1ms) 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
51
- FROM pg_constraint c
52
- JOIN pg_class t1 ON c.conrelid = t1.oid
53
- JOIN pg_class t2 ON c.confrelid = t2.oid
54
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
55
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
56
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
57
- WHERE c.contype = 'f'
58
- AND t1.relname = 'employers'
59
- AND t3.nspname = ANY (current_schemas(false))
60
- ORDER BY c.conname
61
-
62
-  (1.2ms) 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
63
- FROM pg_constraint c
64
- JOIN pg_class t1 ON c.conrelid = t1.oid
65
- JOIN pg_class t2 ON c.confrelid = t2.oid
66
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
67
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
68
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
69
- WHERE c.contype = 'f'
70
- AND t1.relname = 'profiles'
71
- AND t3.nspname = ANY (current_schemas(false))
72
- ORDER BY c.conname
73
- 
74
-  (1.3ms) 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
75
- FROM pg_constraint c
76
- JOIN pg_class t1 ON c.conrelid = t1.oid
77
- JOIN pg_class t2 ON c.confrelid = t2.oid
78
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
79
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
80
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
81
- WHERE c.contype = 'f'
82
- AND t1.relname = 'users'
83
- AND t3.nspname = ANY (current_schemas(false))
84
- ORDER BY c.conname
85
-
86
- SQL (0.1ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
87
-  (31.0ms) 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
-  (17.6ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" USING btree ("commentable_type", "commentable_id")
89
-  (34.4ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
90
-  (12.9ms) CREATE INDEX "index_employers_on_id" ON "employers" USING btree ("id")
91
-  (31.9ms) 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
-  (35.7ms) CREATE 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) 
93
-  (18.0ms) CREATE INDEX "index_users_on_email" ON "users" USING btree ("email")
94
-  (18.2ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" USING btree ("email")
95
-  (18.2ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" USING btree ("employer_id", "country_code")
96
-  (12.9ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" USING btree ("last_name", "first_name", "email")
97
-  (23.8ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")
98
-  (21.1ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")
99
-  (24.6ms) CREATE INDEX "index_users_on_last_name" ON "users" USING btree ("last_name")
100
-  (9.2ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
101
- FOREIGN KEY ("employer_id")
102
- REFERENCES "employers" ("id")
103
- 
104
-  (26.4ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL)
105
-  (26.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
106
-  (0.3ms) SELECT version FROM "schema_migrations"
107
-  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20160604081452')
108
-  (7.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101213')
109
-  (7.5ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101232')
110
-  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101221')
111
- SQL (0.1ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
112
-  (57.5ms) 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
-  (20.9ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" USING btree ("commentable_type", "commentable_id")
114
-  (46.0ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
115
-  (12.2ms) CREATE INDEX "index_employers_on_id" ON "employers" USING btree ("id")
116
-  (29.4ms) 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
-  (32.3ms) CREATE 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) 
118
-  (17.2ms) CREATE INDEX "index_users_on_email" ON "users" USING btree ("email")
119
-  (14.7ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" USING btree ("email")
120
-  (22.9ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" USING btree ("employer_id", "country_code")
121
-  (17.8ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" USING btree ("last_name", "first_name", "email")
122
-  (17.3ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")
123
-  (22.9ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")
124
-  (11.8ms) CREATE INDEX "index_users_on_last_name" ON "users" USING btree ("last_name")
125
-  (8.5ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
126
- FOREIGN KEY ("employer_id")
127
- REFERENCES "employers" ("id")
128
- 
129
-  (21.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL)
130
-  (20.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
131
-  (0.2ms) SELECT version FROM "schema_migrations"
132
-  (4.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20160604081452')
133
-  (7.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101213')
134
-  (7.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101232')
135
-  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101221')
136
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
137
- SQL (0.2ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
138
-  (67.5ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
139
-  (16.0ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" USING btree ("commentable_type", "commentable_id")
140
-  (41.3ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
141
-  (18.7ms) CREATE INDEX "index_employers_on_id" ON "employers" USING btree ("id")
142
-  (55.8ms) 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)
143
-  (38.8ms) CREATE 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) 
144
-  (18.2ms) CREATE INDEX "index_users_on_email" ON "users" USING btree ("email")
145
-  (18.4ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" USING btree ("email")
146
-  (18.3ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" USING btree ("employer_id", "country_code")
147
-  (21.4ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" USING btree ("last_name", "first_name", "email")
148
-  (12.6ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")
149
-  (18.4ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")
150
-  (21.3ms) CREATE INDEX "index_users_on_last_name" ON "users" USING btree ("last_name")
151
-  (9.1ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
152
- FOREIGN KEY ("employer_id")
153
- REFERENCES "employers" ("id")
154
- 
155
-  (27.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL)
156
-  (33.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
157
-  (0.3ms) SELECT version FROM "schema_migrations"
158
-  (7.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160604081452')
159
-  (7.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101213')
160
-  (7.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101232')
161
-  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101221')
162
- SQL (0.1ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
163
-  (51.2ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
164
-  (21.0ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" USING btree ("commentable_type", "commentable_id")
165
-  (29.1ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
166
-  (18.5ms) CREATE INDEX "index_employers_on_id" ON "employers" USING btree ("id")
167
-  (35.1ms) 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)
168
-  (29.1ms) CREATE 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) 
169
-  (20.7ms) CREATE INDEX "index_users_on_email" ON "users" USING btree ("email")
170
-  (23.1ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" USING btree ("email")
171
-  (28.7ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" USING btree ("employer_id", "country_code")
172
-  (24.1ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" USING btree ("last_name", "first_name", "email")
173
-  (23.8ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")
174
-  (24.2ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" USING btree ("last_name", "first_name")
175
-  (18.0ms) CREATE INDEX "index_users_on_last_name" ON "users" USING btree ("last_name")
176
-  (9.3ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
177
- FOREIGN KEY ("employer_id")
178
- REFERENCES "employers" ("id")
179
- 
180
-  (23.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL)
181
-  (12.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
182
-  (0.3ms) SELECT version FROM "schema_migrations"
183
-  (7.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20160604081452')
184
-  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101213')
185
-  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101232')
186
-  (7.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20160213101221')
187
- ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
188
-  (49.4ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
189
-  (22.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
190
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
191
- Migrating to CreateEmployers (20160213101213)
192
-  (0.1ms) BEGIN
193
-  (28.2ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
194
-  (10.7ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
195
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101213"]]
196
-  (15.0ms) COMMIT
197
- Migrating to CreateUsers (20160213101221)
198
-  (0.2ms) BEGIN
199
-  (34.9ms) CREATE 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)
200
-  (0.8ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
201
- FOREIGN KEY ("employer_id")
202
- REFERENCES "employers" ("id")
203
- 
204
-  (20.2ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
205
-  (16.5ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
206
-  (16.2ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
207
-  (19.7ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
208
-  (16.6ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
209
-  (22.2ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
210
-  (10.7ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
211
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101221"]]
212
-  (8.0ms) COMMIT
213
- Migrating to CreateProfiles (20160213101232)
214
-  (0.2ms) BEGIN
215
-  (30.6ms) CREATE TABLE "profiles" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "deleted_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
216
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
217
-  (8.4ms) COMMIT
218
- Migrating to CreateComments (20160604081452)
219
-  (0.1ms) BEGIN
220
-  (44.5ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
221
-  (13.7ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
222
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
223
-  (7.6ms) COMMIT
224
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
225
-  (1.3ms) 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
226
- FROM pg_constraint c
227
- JOIN pg_class t1 ON c.conrelid = t1.oid
228
- JOIN pg_class t2 ON c.confrelid = t2.oid
229
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
230
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
231
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
232
- WHERE c.contype = 'f'
233
- AND t1.relname = 'comments'
234
- AND t3.nspname = ANY (current_schemas(false))
235
- ORDER BY c.conname
236
- 
237
-  (1.1ms) 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
238
- FROM pg_constraint c
239
- JOIN pg_class t1 ON c.conrelid = t1.oid
240
- JOIN pg_class t2 ON c.confrelid = t2.oid
241
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
242
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
243
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
244
- WHERE c.contype = 'f'
245
- AND t1.relname = 'employers'
246
- AND t3.nspname = ANY (current_schemas(false))
247
- ORDER BY c.conname
248
-
249
-  (1.2ms) 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
250
- FROM pg_constraint c
251
- JOIN pg_class t1 ON c.conrelid = t1.oid
252
- JOIN pg_class t2 ON c.confrelid = t2.oid
253
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
254
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
255
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
256
- WHERE c.contype = 'f'
257
- AND t1.relname = 'profiles'
258
- AND t3.nspname = ANY (current_schemas(false))
259
- ORDER BY c.conname
260
- 
261
-  (1.3ms) 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
262
- FROM pg_constraint c
263
- JOIN pg_class t1 ON c.conrelid = t1.oid
264
- JOIN pg_class t2 ON c.confrelid = t2.oid
265
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
266
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
267
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
268
- WHERE c.contype = 'f'
269
- AND t1.relname = 'users'
270
- AND t3.nspname = ANY (current_schemas(false))
271
- ORDER BY c.conname
272
-
273
-  (33.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
274
-  (18.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+  (36.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
5
+  (12.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
275
6
  ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
276
7
  Migrating to CreateEmployers (20160213101213)
277
8
   (0.1ms) BEGIN
278
-  (26.3ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
279
-  (18.7ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
280
- SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101213"]]
281
-  (19.9ms) COMMIT
282
- Migrating to CreateUsers (20160213101221)
283
-  (0.2ms) BEGIN
284
-  (34.0ms) CREATE 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)
285
-  (1.4ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
286
- FOREIGN KEY ("employer_id")
287
- REFERENCES "employers" ("id")
288
- 
289
-  (22.6ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
290
-  (11.1ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
291
-  (10.7ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
292
-  (17.1ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
293
-  (11.2ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
294
-  (15.9ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
295
-  (16.5ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
296
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101221"]]
297
-  (8.9ms) COMMIT
298
- Migrating to CreateProfiles (20160213101232)
299
-  (0.2ms) BEGIN
300
-  (27.5ms) CREATE TABLE "profiles" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "deleted_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
301
-  (19.9ms) CREATE INDEX "index_profiles_on_first_name_and_last_name" ON "profiles" ("first_name", "last_name")
302
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
303
-  (8.1ms) COMMIT
304
- Migrating to CreateComments (20160604081452)
305
-  (0.1ms) BEGIN
306
-  (35.9ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
307
-  (13.4ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
308
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
309
-  (2.6ms) COMMIT
310
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
311
-  (1.6ms) 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
312
- FROM pg_constraint c
313
- JOIN pg_class t1 ON c.conrelid = t1.oid
314
- JOIN pg_class t2 ON c.confrelid = t2.oid
315
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
316
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
317
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
318
- WHERE c.contype = 'f'
319
- AND t1.relname = 'comments'
320
- AND t3.nspname = ANY (current_schemas(false))
321
- ORDER BY c.conname
322
-
323
-  (1.4ms) 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
324
- FROM pg_constraint c
325
- JOIN pg_class t1 ON c.conrelid = t1.oid
326
- JOIN pg_class t2 ON c.confrelid = t2.oid
327
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
328
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
329
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
330
- WHERE c.contype = 'f'
331
- AND t1.relname = 'employers'
332
- AND t3.nspname = ANY (current_schemas(false))
333
- ORDER BY c.conname
334
- 
335
-  (1.5ms) 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
336
- FROM pg_constraint c
337
- JOIN pg_class t1 ON c.conrelid = t1.oid
338
- JOIN pg_class t2 ON c.confrelid = t2.oid
339
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
340
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
341
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
342
- WHERE c.contype = 'f'
343
- AND t1.relname = 'profiles'
344
- AND t3.nspname = ANY (current_schemas(false))
345
- ORDER BY c.conname
346
-
347
-  (1.6ms) 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
348
- FROM pg_constraint c
349
- JOIN pg_class t1 ON c.conrelid = t1.oid
350
- JOIN pg_class t2 ON c.confrelid = t2.oid
351
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
352
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
353
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
354
- WHERE c.contype = 'f'
355
- AND t1.relname = 'users'
356
- AND t3.nspname = ANY (current_schemas(false))
357
- ORDER BY c.conname
358
- 
359
-  (24.1ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
360
-  (13.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
361
- ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
362
- Migrating to CreateEmployers (20160213101213)
363
-  (0.1ms) BEGIN
364
-  (34.6ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "deleted_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
365
-  (14.1ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
366
-  (19.3ms) CREATE INDEX "index_employers_on_name" ON "employers" ("name") WHERE deleted_at IS NULL
9
+  (31.6ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "deleted_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
10
+  (10.5ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id") WHERE deleted_at IS NULL
11
+  (16.4ms) CREATE UNIQUE INDEX "index_employers_on_name_where_undeleted" ON "employers" ("name") WHERE deleted_at IS NULL
367
12
  SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101213"]]
368
-  (12.3ms) COMMIT
13
+  (27.4ms) COMMIT
369
14
  Migrating to CreateUsers (20160213101221)
370
15
   (0.1ms) BEGIN
371
-  (31.0ms) CREATE 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) 
372
-  (1.3ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
16
+  (47.7ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying, "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) 
17
+  (1.0ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
373
18
  FOREIGN KEY ("employer_id")
374
19
  REFERENCES "employers" ("id")
375
20
 
376
-  (16.3ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
377
-  (10.3ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
378
-  (23.0ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
379
-  (19.1ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
380
-  (10.5ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
381
-  (15.8ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
382
-  (20.0ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
21
+  (10.4ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
22
+  (17.5ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
23
+  (10.4ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
24
+  (16.1ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
25
+  (16.4ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
26
+  (13.5ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
27
+  (19.9ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
383
28
  SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101221"]]
384
-  (8.3ms) COMMIT
385
- Migrating to CreateProfiles (20160213101232)
386
-  (0.2ms) BEGIN
387
-  (28.0ms) CREATE TABLE "profiles" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "deleted_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
388
-  (18.9ms) CREATE INDEX "index_profiles_on_first_name_and_last_name" ON "profiles" ("first_name", "last_name")
389
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
390
-  (11.4ms) COMMIT
391
- Migrating to CreateComments (20160604081452)
392
-  (0.2ms) BEGIN
393
-  (22.1ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
394
-  (16.7ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
395
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
396
-  (2.1ms) COMMIT
397
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
398
-  (1.6ms) 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
399
- FROM pg_constraint c
400
- JOIN pg_class t1 ON c.conrelid = t1.oid
401
- JOIN pg_class t2 ON c.confrelid = t2.oid
402
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
403
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
404
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
405
- WHERE c.contype = 'f'
406
- AND t1.relname = 'comments'
407
- AND t3.nspname = ANY (current_schemas(false))
408
- ORDER BY c.conname
409
- 
410
-  (1.4ms) 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
411
- FROM pg_constraint c
412
- JOIN pg_class t1 ON c.conrelid = t1.oid
413
- JOIN pg_class t2 ON c.confrelid = t2.oid
414
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
415
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
416
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
417
- WHERE c.contype = 'f'
418
- AND t1.relname = 'employers'
419
- AND t3.nspname = ANY (current_schemas(false))
420
- ORDER BY c.conname
421
-
422
-  (1.5ms) 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
423
- FROM pg_constraint c
424
- JOIN pg_class t1 ON c.conrelid = t1.oid
425
- JOIN pg_class t2 ON c.confrelid = t2.oid
426
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
427
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
428
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
429
- WHERE c.contype = 'f'
430
- AND t1.relname = 'profiles'
431
- AND t3.nspname = ANY (current_schemas(false))
432
- ORDER BY c.conname
433
- 
434
-  (1.6ms) 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
435
- FROM pg_constraint c
436
- JOIN pg_class t1 ON c.conrelid = t1.oid
437
- JOIN pg_class t2 ON c.confrelid = t2.oid
438
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
439
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
440
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
441
- WHERE c.contype = 'f'
442
- AND t1.relname = 'users'
443
- AND t3.nspname = ANY (current_schemas(false))
444
- ORDER BY c.conname
445
-
446
-  (45.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
447
-  (36.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
448
- ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
449
- Migrating to CreateEmployers (20160213101213)
450
-  (0.1ms) BEGIN
451
-  (23.3ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "deleted_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
452
-  (18.6ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id") WHERE deleted_at IS NULL
453
-  (26.1ms) CREATE INDEX "index_employers_on_name" ON "employers" ("name") WHERE deleted_at IS NULL
454
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101213"]]
455
-  (9.6ms) COMMIT
456
- Migrating to CreateUsers (20160213101221)
457
-  (0.2ms) BEGIN
458
-  (34.7ms) CREATE 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) 
459
-  (1.3ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
460
- FOREIGN KEY ("employer_id")
461
- REFERENCES "employers" ("id")
462
-
463
-  (15.0ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
464
-  (27.7ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
465
-  (11.2ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
466
-  (16.5ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
467
-  (19.7ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
468
-  (15.9ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
469
-  (12.8ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
470
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101221"]]
471
-  (8.0ms) COMMIT
472
- Migrating to CreateProfiles (20160213101232)
473
-  (0.2ms) BEGIN
474
-  (29.6ms) CREATE TABLE "profiles" ("id" serial primary key, "first_name" character varying, "last_name" character varying, "deleted_at" timestamp, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
475
-  (11.0ms) CREATE INDEX "index_profiles_on_first_name_and_last_name" ON "profiles" ("first_name", "last_name")
476
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
477
-  (8.4ms) COMMIT
478
- Migrating to CreateComments (20160604081452)
479
-  (0.1ms) BEGIN
480
-  (33.1ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
481
-  (10.6ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
482
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
483
29
   (11.8ms) COMMIT
484
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
485
-  (1.6ms) 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
486
- FROM pg_constraint c
487
- JOIN pg_class t1 ON c.conrelid = t1.oid
488
- JOIN pg_class t2 ON c.confrelid = t2.oid
489
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
490
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
491
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
492
- WHERE c.contype = 'f'
493
- AND t1.relname = 'comments'
494
- AND t3.nspname = ANY (current_schemas(false))
495
- ORDER BY c.conname
496
- 
497
-  (1.4ms) 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
30
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
31
+  (1.4ms) 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
498
32
  FROM pg_constraint c
499
33
  JOIN pg_class t1 ON c.conrelid = t1.oid
500
34
  JOIN pg_class t2 ON c.confrelid = t2.oid
@@ -505,20 +39,8 @@ WHERE c.contype = 'f'
505
39
  AND t1.relname = 'employers'
506
40
  AND t3.nspname = ANY (current_schemas(false))
507
41
  ORDER BY c.conname
508
-
509
-  (1.5ms) 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
510
- FROM pg_constraint c
511
- JOIN pg_class t1 ON c.conrelid = t1.oid
512
- JOIN pg_class t2 ON c.confrelid = t2.oid
513
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
514
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
515
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
516
- WHERE c.contype = 'f'
517
- AND t1.relname = 'profiles'
518
- AND t3.nspname = ANY (current_schemas(false))
519
- ORDER BY c.conname
520
42
  
521
-  (1.6ms) 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
43
+  (1.2ms) 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
522
44
  FROM pg_constraint c
523
45
  JOIN pg_class t1 ON c.conrelid = t1.oid
524
46
  JOIN pg_class t2 ON c.confrelid = t2.oid
@@ -530,3 +52,21 @@ WHERE c.contype = 'f'
530
52
  AND t3.nspname = ANY (current_schemas(false))
531
53
  ORDER BY c.conname
532
54
 
55
+  (21.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
56
+  (18.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
57
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
58
+  (0.2ms) DROP DATABASE IF EXISTS "active_record_doctor_development"
59
+  (0.1ms) DROP DATABASE IF EXISTS "active_record_doctor_test"
60
+  (214.1ms) CREATE DATABASE "active_record_doctor_development" ENCODING = 'unicode'
61
+  (212.1ms) CREATE DATABASE "active_record_doctor_test" ENCODING = 'unicode'
62
+ SQL (0.1ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
63
+  (1.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL)
64
+  (0.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
65
+  (0.2ms) SELECT version FROM "schema_migrations"
66
+  (0.2ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
67
+ SQL (0.2ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"
68
+  (1.4ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
69
+  (0.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
70
+  (0.2ms) SELECT version FROM "schema_migrations"
71
+  (0.2ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
72
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"