active_record_doctor 1.2.1 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77e91d88c73c0abde19b07e156c791786f7ece7c
4
- data.tar.gz: 9a3621215ceebc560e49479cca23580a90d8d186
3
+ metadata.gz: f49409fa35146d005fc867205172ab87389eacb1
4
+ data.tar.gz: dc70f64059240bed0a55476e1d3576612e33a326
5
5
  SHA512:
6
- metadata.gz: 699fb4ecf72daf74007b931a3cbb47d80c15a63f3c550249b34f71d75b24c52dee4a2e7c385b30af60593f4e0d78b243a888fcd20a0bf0df74d05b5dd66e2ce7
7
- data.tar.gz: bfa9df22d097a869538fa7f939841bcfb17cc2ca5b67484f1f091a04614b90f545cc16c2ddff43b496ea669235b833fe314a7222ec6c43e0b8c124ad2aabea9c
6
+ metadata.gz: 20c65babdee5483b998195228023898a63a035ee601452e556c76424bf5411c1a15e43a2c8d63148063fdb0a0f84aa673e989798e22c5f27ca73c12bada4d091
7
+ data.tar.gz: 6f6c9c0d6df4881fa13a3ff7f204b545ee2a03888ac45371d9b568c363bb0156d94ab40debe136412b33239c119cc2820c3ab643351651711115f6d7bdf22e7c
data/README.md CHANGED
@@ -5,6 +5,7 @@ can:
5
5
 
6
6
  * index unindexed foreign keys
7
7
  * detect extraneous indexes
8
+ * detect missing foreign key constraints
8
9
 
9
10
  More features coming soon!
10
11
 
@@ -99,6 +100,46 @@ example, if there's a unique index on `users.login` and a non-unique index on
99
100
  `users.login, users.domain` then the tool will _not_ suggest dropping
100
101
  `users.login` as it could violate the uniqueness assumption.
101
102
 
103
+ ### Detecting Missing Foreign Key Constraints
104
+
105
+ If `users.profile_id` references a row in `profiles` then this can be expressed
106
+ at the database level with a foreign key constraint. It _forces_
107
+ `users.profile_id` to point to an existing row in `profiles`. The problem is
108
+ that in many legacy Rails apps the constraint isn't enforced at the database
109
+ level.
110
+
111
+ `active_record_doctor` can automatically detect foreign keys that could benefit
112
+ from a foreign key constraint (a future version will generate a migrations that
113
+ add the constraint; for now, it's your job). You can obtain the list of foreign
114
+ keys with the following command:
115
+
116
+ ```bash
117
+ rake active_record_doctor:missing_foreign_keys
118
+ ```
119
+
120
+ The output will look like:
121
+
122
+ ```
123
+ users profile_id
124
+ comments user_id article_id
125
+ ```
126
+
127
+ Tables are listed one per line. Each line starts with a table name followed by
128
+ column names that should have a foreign key constraint. In the example above,
129
+ `users.profile_id`, `comments.user_id`, and `comments.article_id` lack a foreign
130
+ key constraint.
131
+
132
+ In order to add a foreign key constraint to `users.profile_id` use the following
133
+ migration:
134
+
135
+ ```ruby
136
+ class AddForeignKeyConstraintToUsersProfileId < ActiveRecord::Migration
137
+ def change
138
+ add_foreign_key :users, :profiles
139
+ end
140
+ end
141
+ ```
142
+
102
143
  ## Author
103
144
 
104
145
  This gem is developed and maintained by [Greg Navis](http://www.gregnavis.com).
@@ -29,6 +29,12 @@ module ActiveRecordDoctor
29
29
  end
30
30
  end
31
31
  end
32
+
33
+ def print_missing_foreign_keys(missing_foreign_keys)
34
+ @io.puts(missing_foreign_keys.sort.map do |table, columns|
35
+ "#{table} #{columns.sort.join(' ')}"
36
+ end.join("\n"))
37
+ end
32
38
  end
33
39
  end
34
40
  end
@@ -0,0 +1,69 @@
1
+ require "active_record_doctor/compatibility"
2
+ require "active_record_doctor/printers/io_printer"
3
+
4
+ module ActiveRecordDoctor
5
+ module Tasks
6
+ class MissingForeignKeys
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_missing_foreign_keys(missing_foreign_keys)
19
+ end
20
+
21
+ private
22
+
23
+ def missing_foreign_keys
24
+ hash_from_pairs(connection_tables.select do |table|
25
+ "schema_migrations" != table
26
+ end.map do |table|
27
+ [
28
+ table,
29
+ connection.columns(table).select do |column|
30
+ # We need to skip polymorphic associations as they can reference
31
+ # multiple tables but a foreign key constraint can reference
32
+ # a single predefined table.
33
+ id?(table, column) &&
34
+ !foreign_key?(table, column) &&
35
+ !polymorphic_foreign_key?(table, column)
36
+ end.map(&:name)
37
+ ]
38
+ end.select do |table, columns|
39
+ !columns.empty?
40
+ end)
41
+ end
42
+
43
+ def id?(table, column)
44
+ column.name.end_with?("_id")
45
+ end
46
+
47
+ def foreign_key?(table, column)
48
+ connection.foreign_keys(table).any? do |foreign_key|
49
+ foreign_key.options[:column] == column.name
50
+ end
51
+ end
52
+
53
+ def polymorphic_foreign_key?(table, column)
54
+ type_column_name = column.name.sub(/_id\Z/, '_type')
55
+ connection.columns(table).any? do |another_column|
56
+ another_column.name == type_column_name
57
+ end
58
+ end
59
+
60
+ def connection
61
+ @connection ||= ActiveRecord::Base.connection
62
+ end
63
+
64
+ def hash_from_pairs(pairs)
65
+ Hash[*pairs.flatten(1)]
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordDoctor
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require "active_record_doctor/tasks/unindexed_foreign_keys"
2
2
  require "active_record_doctor/tasks/extraneous_indexes"
3
+ require "active_record_doctor/tasks/missing_foreign_keys"
3
4
 
4
5
  namespace :active_record_doctor do
5
6
  task :unindexed_foreign_keys => :environment do
@@ -9,4 +10,8 @@ namespace :active_record_doctor do
9
10
  task :extraneous_indexes => :environment do
10
11
  ActiveRecordDoctor::Tasks::ExtraneousIndexes.run
11
12
  end
13
+
14
+ task :missing_foreign_keys => :environment do
15
+ ActiveRecordDoctor::Tasks::MissingForeignKeys.run
16
+ end
12
17
  end
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ require 'active_record_doctor/tasks/missing_foreign_keys'
4
+
5
+ class ActiveRecordDoctor::Tasks::MissingForeignKeysTest < ActiveSupport::TestCase
6
+ def test_missing_foreign_keys_are_reported
7
+ result = run_task
8
+
9
+ assert_equal({'users' => ['profile_id']}, result)
10
+ end
11
+
12
+ private
13
+
14
+ def run_task
15
+ printer = SpyPrinter.new
16
+ ActiveRecordDoctor::Tasks::MissingForeignKeys.new(printer: printer).run
17
+ printer.missing_foreign_keys
18
+ end
19
+ end
@@ -1,25 +1,19 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- #
7
1
  default: &default
8
- adapter: sqlite3
2
+ adapter: postgresql
3
+ encoding: unicode
9
4
  pool: 5
10
- timeout: 5000
11
5
 
12
6
  development:
13
7
  <<: *default
14
- database: db/development.sqlite3
8
+ database: active_record_doctor_development
15
9
 
16
10
  # Warning: The database defined as "test" will be erased and
17
11
  # re-generated from your development database when you run "rake".
18
12
  # Do not set this db to the same as development or production.
19
13
  test:
20
14
  <<: *default
21
- database: db/test.sqlite3
15
+ database: active_record_doctor_test
22
16
 
23
17
  production:
24
18
  <<: *default
25
- database: db/production.sqlite3
19
+ database: active_record_doctor_production
@@ -0,0 +1,5 @@
1
+ test:
2
+ adapter: postgresql
3
+ user: postgres
4
+ password:
5
+ database: active_record_doctor_test
@@ -4,7 +4,7 @@ class CreateUsers < ActiveRecord::Migration
4
4
  t.string :email
5
5
  t.string :first_name
6
6
  t.string :last_name
7
- t.references :profile, foreign_key: true
7
+ t.references :profile, foreign_key: false
8
8
  t.references :employer, foreign_key: true
9
9
  t.string :country_code, null: false
10
10
 
@@ -13,6 +13,9 @@
13
13
 
14
14
  ActiveRecord::Schema.define(version: 20160604081452) do
15
15
 
16
+ # These are extensions that must be enabled in order to support this database
17
+ enable_extension "plpgsql"
18
+
16
19
  create_table "comments", force: :cascade do |t|
17
20
  t.integer "commentable_id"
18
21
  t.string "commentable_type"
@@ -20,7 +23,7 @@ ActiveRecord::Schema.define(version: 20160604081452) do
20
23
  t.datetime "updated_at", null: false
21
24
  end
22
25
 
23
- add_index "comments", ["commentable_type", "commentable_id"], name: "index_comments_on_commentable_type_and_commentable_id"
26
+ add_index "comments", ["commentable_type", "commentable_id"], name: "index_comments_on_commentable_type_and_commentable_id", using: :btree
24
27
 
25
28
  create_table "employers", force: :cascade do |t|
26
29
  t.string "name"
@@ -28,7 +31,7 @@ ActiveRecord::Schema.define(version: 20160604081452) do
28
31
  t.datetime "updated_at", null: false
29
32
  end
30
33
 
31
- add_index "employers", ["id"], name: "index_employers_on_id"
34
+ add_index "employers", ["id"], name: "index_employers_on_id", using: :btree
32
35
 
33
36
  create_table "profiles", force: :cascade do |t|
34
37
  t.string "first_name"
@@ -48,12 +51,13 @@ ActiveRecord::Schema.define(version: 20160604081452) do
48
51
  t.datetime "updated_at", null: false
49
52
  end
50
53
 
51
- add_index "users", ["email"], name: "index_users_on_email"
52
- add_index "users", ["email"], name: "unique_index_on_users_email", unique: true
53
- add_index "users", ["employer_id", "country_code"], name: "index_users_on_employer_id_and_country_code"
54
- add_index "users", ["last_name", "first_name", "email"], name: "index_users_on_last_name_and_first_name_and_email"
55
- add_index "users", ["last_name", "first_name"], name: "index_users_on_last_name_and_first_name"
56
- add_index "users", ["last_name", "first_name"], name: "unique_index_on_users_last_name_and_first_name", unique: true
57
- add_index "users", ["last_name"], name: "index_users_on_last_name"
54
+ add_index "users", ["email"], name: "index_users_on_email", using: :btree
55
+ add_index "users", ["email"], name: "unique_index_on_users_email", unique: true, using: :btree
56
+ add_index "users", ["employer_id", "country_code"], name: "index_users_on_employer_id_and_country_code", using: :btree
57
+ add_index "users", ["last_name", "first_name", "email"], name: "index_users_on_last_name_and_first_name_and_email", using: :btree
58
+ add_index "users", ["last_name", "first_name"], name: "index_users_on_last_name_and_first_name", using: :btree
59
+ add_index "users", ["last_name", "first_name"], name: "unique_index_on_users_last_name_and_first_name", unique: true, using: :btree
60
+ add_index "users", ["last_name"], name: "index_users_on_last_name", using: :btree
58
61
 
62
+ add_foreign_key "users", "employers"
59
63
  end
Binary file
@@ -4690,3 +4690,1009 @@ Migrating to CreateComments (20160604081452)
4690
4690
  FROM sqlite_temp_master
4691
4691
  WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4692
4692
 
4693
+  (28.5ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
4694
+  (0.0ms) select sqlite_version(*)
4695
+  (26.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4696
+ ActiveRecord::SchemaMigration Load (0.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
4697
+ Migrating to CreateUsers (20160213101213)
4698
+  (0.0ms) begin transaction
4699
+  (0.1ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "email" varchar, "first_name" varchar, "last_name" varchar, "profile_id" integer, "employer_id" integer, "country_code" varchar NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
4700
+  (0.1ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
4701
+  (0.1ms) SELECT sql
4702
+ FROM sqlite_master
4703
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4704
+ UNION ALL
4705
+ SELECT sql
4706
+ FROM sqlite_temp_master
4707
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4708
+
4709
+  (0.1ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
4710
+  (0.0ms) SELECT sql
4711
+ FROM sqlite_master
4712
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4713
+ UNION ALL
4714
+ SELECT sql
4715
+ FROM sqlite_temp_master
4716
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4717
+
4718
+  (0.0ms)  SELECT sql
4719
+ FROM sqlite_master
4720
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4721
+ UNION ALL
4722
+ SELECT sql
4723
+ FROM sqlite_temp_master
4724
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4725
+ 
4726
+  (0.1ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
4727
+  (0.0ms)  SELECT sql
4728
+ FROM sqlite_master
4729
+ WHERE name='unique_index_on_users_last_name_and_first_name' AND type='index'
4730
+ UNION ALL
4731
+ SELECT sql
4732
+ FROM sqlite_temp_master
4733
+ WHERE name='unique_index_on_users_last_name_and_first_name' AND type='index'
4734
+ 
4735
+  (0.0ms) SELECT sql
4736
+ FROM sqlite_master
4737
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4738
+ UNION ALL
4739
+ SELECT sql
4740
+ FROM sqlite_temp_master
4741
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4742
+
4743
+  (0.0ms)  SELECT sql
4744
+ FROM sqlite_master
4745
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4746
+ UNION ALL
4747
+ SELECT sql
4748
+ FROM sqlite_temp_master
4749
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4750
+ 
4751
+  (0.1ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
4752
+  (0.0ms)  SELECT sql
4753
+ FROM sqlite_master
4754
+ WHERE name='index_users_on_last_name' AND type='index'
4755
+ UNION ALL
4756
+ SELECT sql
4757
+ FROM sqlite_temp_master
4758
+ WHERE name='index_users_on_last_name' AND type='index'
4759
+ 
4760
+  (0.0ms) SELECT sql
4761
+ FROM sqlite_master
4762
+ WHERE name='unique_index_on_users_last_name_and_first_name' AND type='index'
4763
+ UNION ALL
4764
+ SELECT sql
4765
+ FROM sqlite_temp_master
4766
+ WHERE name='unique_index_on_users_last_name_and_first_name' AND type='index'
4767
+
4768
+  (0.0ms)  SELECT sql
4769
+ FROM sqlite_master
4770
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4771
+ UNION ALL
4772
+ SELECT sql
4773
+ FROM sqlite_temp_master
4774
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4775
+ 
4776
+  (0.0ms) SELECT sql
4777
+ FROM sqlite_master
4778
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4779
+ UNION ALL
4780
+ SELECT sql
4781
+ FROM sqlite_temp_master
4782
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4783
+
4784
+  (0.1ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
4785
+  (0.0ms) SELECT sql
4786
+ FROM sqlite_master
4787
+ WHERE name='index_users_on_email' AND type='index'
4788
+ UNION ALL
4789
+ SELECT sql
4790
+ FROM sqlite_temp_master
4791
+ WHERE name='index_users_on_email' AND type='index'
4792
+
4793
+  (0.0ms)  SELECT sql
4794
+ FROM sqlite_master
4795
+ WHERE name='index_users_on_last_name' AND type='index'
4796
+ UNION ALL
4797
+ SELECT sql
4798
+ FROM sqlite_temp_master
4799
+ WHERE name='index_users_on_last_name' AND type='index'
4800
+ 
4801
+  (0.0ms) SELECT sql
4802
+ FROM sqlite_master
4803
+ WHERE name='unique_index_on_users_last_name_and_first_name' AND type='index'
4804
+ UNION ALL
4805
+ SELECT sql
4806
+ FROM sqlite_temp_master
4807
+ WHERE name='unique_index_on_users_last_name_and_first_name' AND type='index'
4808
+
4809
+  (0.0ms)  SELECT sql
4810
+ FROM sqlite_master
4811
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4812
+ UNION ALL
4813
+ SELECT sql
4814
+ FROM sqlite_temp_master
4815
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4816
+ 
4817
+  (0.0ms) SELECT sql
4818
+ FROM sqlite_master
4819
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4820
+ UNION ALL
4821
+ SELECT sql
4822
+ FROM sqlite_temp_master
4823
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4824
+
4825
+  (0.1ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
4826
+  (0.0ms) SELECT sql
4827
+ FROM sqlite_master
4828
+ WHERE name='unique_index_on_users_email' AND type='index'
4829
+ UNION ALL
4830
+ SELECT sql
4831
+ FROM sqlite_temp_master
4832
+ WHERE name='unique_index_on_users_email' AND type='index'
4833
+
4834
+  (0.0ms)  SELECT sql
4835
+ FROM sqlite_master
4836
+ WHERE name='index_users_on_email' AND type='index'
4837
+ UNION ALL
4838
+ SELECT sql
4839
+ FROM sqlite_temp_master
4840
+ WHERE name='index_users_on_email' AND type='index'
4841
+ 
4842
+  (0.0ms) SELECT sql
4843
+ FROM sqlite_master
4844
+ WHERE name='index_users_on_last_name' AND type='index'
4845
+ UNION ALL
4846
+ SELECT sql
4847
+ FROM sqlite_temp_master
4848
+ WHERE name='index_users_on_last_name' AND type='index'
4849
+
4850
+  (0.0ms)  SELECT sql
4851
+ FROM sqlite_master
4852
+ WHERE name='unique_index_on_users_last_name_and_first_name' AND type='index'
4853
+ UNION ALL
4854
+ SELECT sql
4855
+ FROM sqlite_temp_master
4856
+ WHERE name='unique_index_on_users_last_name_and_first_name' AND type='index'
4857
+ 
4858
+  (0.0ms) SELECT sql
4859
+ FROM sqlite_master
4860
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4861
+ UNION ALL
4862
+ SELECT sql
4863
+ FROM sqlite_temp_master
4864
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4865
+
4866
+  (0.0ms)  SELECT sql
4867
+ FROM sqlite_master
4868
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4869
+ UNION ALL
4870
+ SELECT sql
4871
+ FROM sqlite_temp_master
4872
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4873
+ 
4874
+  (0.1ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
4875
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160213101213"]]
4876
+  (30.4ms) commit transaction
4877
+ Migrating to CreateProfiles (20160213101232)
4878
+  (0.0ms) begin transaction
4879
+  (0.1ms) CREATE TABLE "profiles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "first_name" varchar, "last_name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
4880
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160213101232"]]
4881
+  (21.5ms) commit transaction
4882
+ Migrating to CreateEmployers (20160213102131)
4883
+  (0.0ms) begin transaction
4884
+  (0.1ms) CREATE TABLE "employers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
4885
+  (0.1ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
4886
+ SQL (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160213102131"]]
4887
+  (29.9ms) commit transaction
4888
+ Migrating to CreateComments (20160604081452)
4889
+  (0.0ms) begin transaction
4890
+  (0.1ms) CREATE TABLE "comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "commentable_id" integer, "commentable_type" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
4891
+  (0.1ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
4892
+ SQL (0.0ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160604081452"]]
4893
+  (22.1ms) commit transaction
4894
+ ActiveRecord::SchemaMigration Load (0.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
4895
+  (0.1ms) SELECT sql
4896
+ FROM sqlite_master
4897
+ WHERE name='index_comments_on_commentable_type_and_commentable_id' AND type='index'
4898
+ UNION ALL
4899
+ SELECT sql
4900
+ FROM sqlite_temp_master
4901
+ WHERE name='index_comments_on_commentable_type_and_commentable_id' AND type='index'
4902
+
4903
+  (0.0ms)  SELECT sql
4904
+ FROM sqlite_master
4905
+ WHERE name='index_employers_on_id' AND type='index'
4906
+ UNION ALL
4907
+ SELECT sql
4908
+ FROM sqlite_temp_master
4909
+ WHERE name='index_employers_on_id' AND type='index'
4910
+ 
4911
+  (0.0ms) SELECT sql
4912
+ FROM sqlite_master
4913
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
4914
+ UNION ALL
4915
+ SELECT sql
4916
+ FROM sqlite_temp_master
4917
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
4918
+
4919
+  (0.0ms)  SELECT sql
4920
+ FROM sqlite_master
4921
+ WHERE name='unique_index_on_users_email' AND type='index'
4922
+ UNION ALL
4923
+ SELECT sql
4924
+ FROM sqlite_temp_master
4925
+ WHERE name='unique_index_on_users_email' AND type='index'
4926
+ 
4927
+  (0.0ms) SELECT sql
4928
+ FROM sqlite_master
4929
+ WHERE name='index_users_on_email' AND type='index'
4930
+ UNION ALL
4931
+ SELECT sql
4932
+ FROM sqlite_temp_master
4933
+ WHERE name='index_users_on_email' AND type='index'
4934
+
4935
+  (0.0ms)  SELECT sql
4936
+ FROM sqlite_master
4937
+ WHERE name='index_users_on_last_name' AND type='index'
4938
+ UNION ALL
4939
+ SELECT sql
4940
+ FROM sqlite_temp_master
4941
+ WHERE name='index_users_on_last_name' AND type='index'
4942
+ 
4943
+  (0.0ms) SELECT sql
4944
+ FROM sqlite_master
4945
+ WHERE name='unique_index_on_users_last_name_and_first_name' AND type='index'
4946
+ UNION ALL
4947
+ SELECT sql
4948
+ FROM sqlite_temp_master
4949
+ WHERE name='unique_index_on_users_last_name_and_first_name' AND type='index'
4950
+
4951
+  (0.0ms)  SELECT sql
4952
+ FROM sqlite_master
4953
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4954
+ UNION ALL
4955
+ SELECT sql
4956
+ FROM sqlite_temp_master
4957
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
4958
+ 
4959
+  (0.0ms) SELECT sql
4960
+ FROM sqlite_master
4961
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4962
+ UNION ALL
4963
+ SELECT sql
4964
+ FROM sqlite_temp_master
4965
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
4966
+
4967
+  (36.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
4968
+  (18.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4969
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4970
+ Migrating to CreateUsers (20160213101213)
4971
+  (0.1ms) BEGIN
4972
+  (36.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) 
4973
+  (0.5ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
4974
+ FOREIGN KEY ("employer_id")
4975
+ REFERENCES "employers" ("id")
4976
+
4977
+  (0.1ms) ROLLBACK
4978
+  (34.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
4979
+  (32.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4980
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4981
+ Migrating to CreateEmployers (20160213101213)
4982
+  (0.1ms) BEGIN
4983
+  (31.8ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
4984
+  (12.3ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
4985
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101213"]]
4986
+  (12.2ms) COMMIT
4987
+ Migrating to CreateUsers (20160213101221)
4988
+  (0.1ms) BEGIN
4989
+  (25.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)
4990
+  (0.8ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
4991
+ FOREIGN KEY ("employer_id")
4992
+ REFERENCES "employers" ("id")
4993
+ 
4994
+  (12.3ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
4995
+  (18.2ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
4996
+  (20.5ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
4997
+  (12.5ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
4998
+  (11.6ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
4999
+  (11.2ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
5000
+  (17.6ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
5001
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101221"]]
5002
+  (2.6ms) COMMIT
5003
+ Migrating to CreateProfiles (20160213101232)
5004
+  (0.2ms) BEGIN
5005
+  (36.7ms) 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)
5006
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
5007
+  (8.2ms) COMMIT
5008
+ Migrating to CreateComments (20160604081452)
5009
+  (0.1ms) BEGIN
5010
+  (38.4ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
5011
+  (21.1ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
5012
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
5013
+  (15.9ms) COMMIT
5014
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5015
+  (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
5016
+ FROM pg_constraint c
5017
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5018
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5019
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5020
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5021
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5022
+ WHERE c.contype = 'f'
5023
+ AND t1.relname = 'comments'
5024
+ AND t3.nspname = ANY (current_schemas(false))
5025
+ ORDER BY c.conname
5026
+ 
5027
+  (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
5028
+ FROM pg_constraint c
5029
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5030
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5031
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5032
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5033
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5034
+ WHERE c.contype = 'f'
5035
+ AND t1.relname = 'employers'
5036
+ AND t3.nspname = ANY (current_schemas(false))
5037
+ ORDER BY c.conname
5038
+
5039
+  (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
5040
+ FROM pg_constraint c
5041
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5042
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5043
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5044
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5045
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5046
+ WHERE c.contype = 'f'
5047
+ AND t1.relname = 'profiles'
5048
+ AND t3.nspname = ANY (current_schemas(false))
5049
+ ORDER BY c.conname
5050
+ 
5051
+  (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
5052
+ FROM pg_constraint c
5053
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5054
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5055
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5056
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5057
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5058
+ WHERE c.contype = 'f'
5059
+ AND t1.relname = 'users'
5060
+ AND t3.nspname = ANY (current_schemas(false))
5061
+ ORDER BY c.conname
5062
+
5063
+  (23.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
5064
+  (18.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5065
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5066
+ Migrating to CreateUsers (20160213101213)
5067
+  (0.2ms) BEGIN
5068
+  (27.4ms) 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) 
5069
+  (0.7ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_a8794354f0"
5070
+ FOREIGN KEY ("profile_id")
5071
+ REFERENCES "profiles" ("id")
5072
+
5073
+  (0.1ms) ROLLBACK
5074
+  (26.6ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
5075
+  (18.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5076
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5077
+ Migrating to CreateUsers (20160213101213)
5078
+  (0.1ms) BEGIN
5079
+  (35.6ms) 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) 
5080
+  (0.6ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_a8794354f0"
5081
+ FOREIGN KEY ("profile_id")
5082
+ REFERENCES "profiles" ("id")
5083
+
5084
+  (0.1ms) ROLLBACK
5085
+  (37.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
5086
+  (23.2ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5087
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5088
+ Migrating to CreateProfiles (20160213101232)
5089
+  (0.1ms) BEGIN
5090
+  (47.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) 
5091
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
5092
+  (15.1ms) COMMIT
5093
+ Migrating to CreateUsers (20160213101513)
5094
+  (0.1ms) BEGIN
5095
+  (32.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) 
5096
+  (0.8ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_a8794354f0"
5097
+ FOREIGN KEY ("profile_id")
5098
+ REFERENCES "profiles" ("id")
5099
+
5100
+  (0.6ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
5101
+ FOREIGN KEY ("employer_id")
5102
+ REFERENCES "employers" ("id")
5103
+ 
5104
+  (0.1ms) ROLLBACK
5105
+  (26.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
5106
+  (18.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5107
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5108
+ Migrating to CreateProfiles (20160213101232)
5109
+  (0.1ms) BEGIN
5110
+  (30.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) 
5111
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
5112
+  (13.5ms) COMMIT
5113
+ Migrating to CreateEmployers (20160213102131)
5114
+  (0.1ms) BEGIN
5115
+  (26.5ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
5116
+  (15.9ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
5117
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213102131"]]
5118
+  (16.7ms) COMMIT
5119
+ Migrating to CreateUsers (20160213103017)
5120
+  (0.1ms) BEGIN
5121
+  (22.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)
5122
+  (0.9ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_a8794354f0"
5123
+ FOREIGN KEY ("profile_id")
5124
+ REFERENCES "profiles" ("id")
5125
+ 
5126
+  (0.5ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
5127
+ FOREIGN KEY ("employer_id")
5128
+ REFERENCES "employers" ("id")
5129
+
5130
+  (32.9ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
5131
+  (16.1ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
5132
+  (13.0ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
5133
+  (16.4ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
5134
+  (15.7ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
5135
+  (10.1ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
5136
+  (10.7ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
5137
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213103017"]]
5138
+  (7.7ms) COMMIT
5139
+ Migrating to CreateComments (20160604081452)
5140
+  (0.2ms) BEGIN
5141
+  (30.8ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
5142
+  (10.4ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
5143
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
5144
+  (8.3ms) COMMIT
5145
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5146
+  (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
5147
+ FROM pg_constraint c
5148
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5149
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5150
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5151
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5152
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5153
+ WHERE c.contype = 'f'
5154
+ AND t1.relname = 'comments'
5155
+ AND t3.nspname = ANY (current_schemas(false))
5156
+ ORDER BY c.conname
5157
+
5158
+  (1.0ms) 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
5159
+ FROM pg_constraint c
5160
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5161
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5162
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5163
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5164
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5165
+ WHERE c.contype = 'f'
5166
+ AND t1.relname = 'employers'
5167
+ AND t3.nspname = ANY (current_schemas(false))
5168
+ ORDER BY c.conname
5169
+ 
5170
+  (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
5171
+ FROM pg_constraint c
5172
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5173
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5174
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5175
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5176
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5177
+ WHERE c.contype = 'f'
5178
+ AND t1.relname = 'profiles'
5179
+ AND t3.nspname = ANY (current_schemas(false))
5180
+ ORDER BY c.conname
5181
+
5182
+  (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
5183
+ FROM pg_constraint c
5184
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5185
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5186
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5187
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5188
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5189
+ WHERE c.contype = 'f'
5190
+ AND t1.relname = 'users'
5191
+ AND t3.nspname = ANY (current_schemas(false))
5192
+ ORDER BY c.conname
5193
+ 
5194
+  (44.1ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
5195
+  (27.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5196
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5197
+ Migrating to CreateEmployers (20160213101213)
5198
+  (0.1ms) BEGIN
5199
+  (43.3ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
5200
+  (10.5ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
5201
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101213"]]
5202
+  (17.8ms) COMMIT
5203
+ Migrating to CreateUsers (20160213101221)
5204
+  (0.1ms) BEGIN
5205
+  (30.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)
5206
+  (0.8ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
5207
+ FOREIGN KEY ("employer_id")
5208
+ REFERENCES "employers" ("id")
5209
+ 
5210
+  (11.0ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
5211
+  (16.3ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
5212
+  (16.9ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
5213
+  (10.3ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
5214
+  (16.3ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
5215
+  (10.6ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
5216
+  (15.9ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
5217
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101221"]]
5218
+  (8.0ms) COMMIT
5219
+ Migrating to CreateProfiles (20160213101232)
5220
+  (0.1ms) BEGIN
5221
+  (30.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)
5222
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
5223
+  (8.3ms) COMMIT
5224
+ Migrating to CreateComments (20160604081452)
5225
+  (0.1ms) BEGIN
5226
+  (32.6ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)
5227
+  (16.3ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
5228
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
5229
+  (8.5ms) COMMIT
5230
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5231
+  (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
5232
+ FROM pg_constraint c
5233
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5234
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5235
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5236
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5237
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5238
+ WHERE c.contype = 'f'
5239
+ AND t1.relname = 'comments'
5240
+ AND t3.nspname = ANY (current_schemas(false))
5241
+ ORDER BY c.conname
5242
+ 
5243
+  (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
5244
+ FROM pg_constraint c
5245
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5246
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5247
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5248
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5249
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5250
+ WHERE c.contype = 'f'
5251
+ AND t1.relname = 'employers'
5252
+ AND t3.nspname = ANY (current_schemas(false))
5253
+ ORDER BY c.conname
5254
+
5255
+  (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
5256
+ FROM pg_constraint c
5257
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5258
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5259
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5260
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5261
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5262
+ WHERE c.contype = 'f'
5263
+ AND t1.relname = 'profiles'
5264
+ AND t3.nspname = ANY (current_schemas(false))
5265
+ ORDER BY c.conname
5266
+ 
5267
+  (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
5268
+ FROM pg_constraint c
5269
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5270
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5271
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5272
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5273
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5274
+ WHERE c.contype = 'f'
5275
+ AND t1.relname = 'users'
5276
+ AND t3.nspname = ANY (current_schemas(false))
5277
+ ORDER BY c.conname
5278
+
5279
+  (40.1ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
5280
+  (24.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5281
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5282
+ Migrating to CreateProfiles (20160213101232)
5283
+  (0.1ms) BEGIN
5284
+  (30.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) 
5285
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
5286
+  (15.9ms) COMMIT
5287
+ Migrating to CreateEmployers (20160213102131)
5288
+  (0.1ms) BEGIN
5289
+  (40.9ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
5290
+  (23.9ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
5291
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213102131"]]
5292
+  (11.4ms) COMMIT
5293
+ Migrating to CreateUsers (20160213103017)
5294
+  (0.1ms) BEGIN
5295
+  (33.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)
5296
+  (0.8ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_a8794354f0"
5297
+ FOREIGN KEY ("profile_id")
5298
+ REFERENCES "profiles" ("id")
5299
+ 
5300
+  (0.5ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
5301
+ FOREIGN KEY ("employer_id")
5302
+ REFERENCES "employers" ("id")
5303
+
5304
+  (18.5ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
5305
+  (31.4ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
5306
+  (13.4ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
5307
+  (13.4ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
5308
+  (16.0ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
5309
+  (16.8ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
5310
+  (10.6ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
5311
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213103017"]]
5312
+  (11.2ms) COMMIT
5313
+ Migrating to CreateComments (20160604081452)
5314
+  (0.2ms) BEGIN
5315
+  (30.3ms) CREATE TABLE "comments" ("id" serial primary key, "commentable_id" integer, "commentable_type" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
5316
+  (24.9ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
5317
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
5318
+  (7.8ms) COMMIT
5319
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5320
+  (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
5321
+ FROM pg_constraint c
5322
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5323
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5324
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5325
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5326
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5327
+ WHERE c.contype = 'f'
5328
+ AND t1.relname = 'comments'
5329
+ AND t3.nspname = ANY (current_schemas(false))
5330
+ ORDER BY c.conname
5331
+
5332
+  (1.0ms) 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
5333
+ FROM pg_constraint c
5334
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5335
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5336
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5337
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5338
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5339
+ WHERE c.contype = 'f'
5340
+ AND t1.relname = 'employers'
5341
+ AND t3.nspname = ANY (current_schemas(false))
5342
+ ORDER BY c.conname
5343
+ 
5344
+  (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
5345
+ FROM pg_constraint c
5346
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5347
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5348
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5349
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5350
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5351
+ WHERE c.contype = 'f'
5352
+ AND t1.relname = 'profiles'
5353
+ AND t3.nspname = ANY (current_schemas(false))
5354
+ ORDER BY c.conname
5355
+
5356
+  (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
5357
+ FROM pg_constraint c
5358
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5359
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5360
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5361
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5362
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5363
+ WHERE c.contype = 'f'
5364
+ AND t1.relname = 'users'
5365
+ AND t3.nspname = ANY (current_schemas(false))
5366
+ ORDER BY c.conname
5367
+ 
5368
+  (30.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
5369
+  (17.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5370
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5371
+ Migrating to CreateProfiles (20160213101232)
5372
+  (0.1ms) BEGIN
5373
+  (35.5ms) 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) 
5374
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
5375
+  (10.8ms) COMMIT
5376
+ Migrating to CreateEmployers (20160213102131)
5377
+  (0.1ms) BEGIN
5378
+  (34.7ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
5379
+  (10.3ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
5380
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213102131"]]
5381
+  (13.4ms) COMMIT
5382
+ Migrating to CreateUsers (20160213103017)
5383
+  (0.1ms) BEGIN
5384
+  (26.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)
5385
+  (0.7ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_a8794354f0"
5386
+ FOREIGN KEY ("profile_id")
5387
+ REFERENCES "profiles" ("id")
5388
+ 
5389
+  (0.4ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
5390
+ FOREIGN KEY ("employer_id")
5391
+ REFERENCES "employers" ("id")
5392
+
5393
+  (15.8ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
5394
+  (23.4ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
5395
+  (10.3ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
5396
+  (13.3ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
5397
+  (9.9ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
5398
+  (16.0ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
5399
+  (13.2ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
5400
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213103017"]]
5401
+  (7.7ms) COMMIT
5402
+ Migrating to CreateComments (20160604081452)
5403
+  (0.2ms) BEGIN
5404
+  (26.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) 
5405
+  (14.1ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
5406
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
5407
+  (8.3ms) COMMIT
5408
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5409
+  (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
5410
+ FROM pg_constraint c
5411
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5412
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5413
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5414
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5415
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5416
+ WHERE c.contype = 'f'
5417
+ AND t1.relname = 'comments'
5418
+ AND t3.nspname = ANY (current_schemas(false))
5419
+ ORDER BY c.conname
5420
+
5421
+  (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
5422
+ FROM pg_constraint c
5423
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5424
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5425
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5426
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5427
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5428
+ WHERE c.contype = 'f'
5429
+ AND t1.relname = 'employers'
5430
+ AND t3.nspname = ANY (current_schemas(false))
5431
+ ORDER BY c.conname
5432
+ 
5433
+  (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
5434
+ FROM pg_constraint c
5435
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5436
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5437
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5438
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5439
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5440
+ WHERE c.contype = 'f'
5441
+ AND t1.relname = 'profiles'
5442
+ AND t3.nspname = ANY (current_schemas(false))
5443
+ ORDER BY c.conname
5444
+
5445
+  (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
5446
+ FROM pg_constraint c
5447
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5448
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5449
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5450
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5451
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5452
+ WHERE c.contype = 'f'
5453
+ AND t1.relname = 'users'
5454
+ AND t3.nspname = ANY (current_schemas(false))
5455
+ ORDER BY c.conname
5456
+ 
5457
+  (34.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
5458
+  (26.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5459
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5460
+ Migrating to CreateEmployers (20160213101213)
5461
+  (0.1ms) BEGIN
5462
+  (36.1ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
5463
+  (10.4ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
5464
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101213"]]
5465
+  (16.2ms) COMMIT
5466
+ Migrating to CreateUsers (20160213101221)
5467
+  (0.1ms) BEGIN
5468
+  (32.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)
5469
+  (0.8ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
5470
+ FOREIGN KEY ("employer_id")
5471
+ REFERENCES "employers" ("id")
5472
+ 
5473
+  (19.1ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
5474
+  (9.8ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
5475
+  (16.6ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
5476
+  (13.7ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
5477
+  (18.7ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
5478
+  (16.3ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
5479
+  (15.9ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
5480
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101221"]]
5481
+  (7.9ms) COMMIT
5482
+ Migrating to CreateProfiles (20160213101232)
5483
+  (0.1ms) BEGIN
5484
+  (24.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)
5485
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
5486
+  (8.3ms) COMMIT
5487
+ Migrating to CreateComments (20160604081452)
5488
+  (0.1ms) BEGIN
5489
+  (33.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)
5490
+  (9.9ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
5491
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
5492
+  (8.3ms) COMMIT
5493
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5494
+  (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
5495
+ FROM pg_constraint c
5496
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5497
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5498
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5499
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5500
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5501
+ WHERE c.contype = 'f'
5502
+ AND t1.relname = 'comments'
5503
+ AND t3.nspname = ANY (current_schemas(false))
5504
+ ORDER BY c.conname
5505
+ 
5506
+  (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
5507
+ FROM pg_constraint c
5508
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5509
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5510
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5511
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5512
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5513
+ WHERE c.contype = 'f'
5514
+ AND t1.relname = 'employers'
5515
+ AND t3.nspname = ANY (current_schemas(false))
5516
+ ORDER BY c.conname
5517
+
5518
+  (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
5519
+ FROM pg_constraint c
5520
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5521
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5522
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5523
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5524
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5525
+ WHERE c.contype = 'f'
5526
+ AND t1.relname = 'profiles'
5527
+ AND t3.nspname = ANY (current_schemas(false))
5528
+ ORDER BY c.conname
5529
+ 
5530
+  (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
5531
+ FROM pg_constraint c
5532
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5533
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5534
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5535
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5536
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5537
+ WHERE c.contype = 'f'
5538
+ AND t1.relname = 'users'
5539
+ AND t3.nspname = ANY (current_schemas(false))
5540
+ ORDER BY c.conname
5541
+
5542
+  (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
5543
+ FROM pg_constraint c
5544
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5545
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5546
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5547
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5548
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5549
+ WHERE c.contype = 'f'
5550
+ AND t1.relname = 'users'
5551
+ AND t3.nspname = ANY (current_schemas(false))
5552
+ ORDER BY c.conname
5553
+ 
5554
+  (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
5555
+ FROM pg_constraint c
5556
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5557
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5558
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5559
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5560
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5561
+ WHERE c.contype = 'f'
5562
+ AND t1.relname = 'users'
5563
+ AND t3.nspname = ANY (current_schemas(false))
5564
+ ORDER BY c.conname
5565
+
5566
+  (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
5567
+ FROM pg_constraint c
5568
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5569
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5570
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5571
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5572
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5573
+ WHERE c.contype = 'f'
5574
+ AND t1.relname = 'comments'
5575
+ AND t3.nspname = ANY (current_schemas(false))
5576
+ ORDER BY c.conname
5577
+ 
5578
+  (2.0ms) 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
5579
+ FROM pg_constraint c
5580
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5581
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5582
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5583
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5584
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5585
+ WHERE c.contype = 'f'
5586
+ AND t1.relname = 'users'
5587
+ AND t3.nspname = ANY (current_schemas(false))
5588
+ ORDER BY c.conname
5589
+ 
5590
+  (1.9ms) 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
5591
+ FROM pg_constraint c
5592
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5593
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5594
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5595
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5596
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5597
+ WHERE c.contype = 'f'
5598
+ AND t1.relname = 'users'
5599
+ AND t3.nspname = ANY (current_schemas(false))
5600
+ ORDER BY c.conname
5601
+
5602
+  (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
5603
+ FROM pg_constraint c
5604
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5605
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5606
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5607
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5608
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5609
+ WHERE c.contype = 'f'
5610
+ AND t1.relname = 'comments'
5611
+ AND t3.nspname = ANY (current_schemas(false))
5612
+ ORDER BY c.conname
5613
+ 
5614
+  (20.1ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
5615
+  (18.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
5616
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5617
+ Migrating to CreateEmployers (20160213101213)
5618
+  (0.1ms) BEGIN
5619
+  (32.9ms) CREATE TABLE "employers" ("id" serial primary key, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
5620
+  (18.9ms) CREATE INDEX "index_employers_on_id" ON "employers" ("id")
5621
+ SQL (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101213"]]
5622
+  (2.7ms) COMMIT
5623
+ Migrating to CreateUsers (20160213101221)
5624
+  (0.1ms) BEGIN
5625
+  (26.4ms) 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)
5626
+  (1.2ms) ALTER TABLE "users" ADD CONSTRAINT "fk_rails_e0dbdd604c"
5627
+ FOREIGN KEY ("employer_id")
5628
+ REFERENCES "employers" ("id")
5629
+ 
5630
+  (10.6ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
5631
+  (10.3ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
5632
+  (10.3ms) CREATE UNIQUE INDEX "unique_index_on_users_last_name_and_first_name" ON "users" ("last_name", "first_name")
5633
+  (15.6ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
5634
+  (15.7ms) CREATE INDEX "index_users_on_email" ON "users" ("email")
5635
+  (22.6ms) CREATE UNIQUE INDEX "unique_index_on_users_email" ON "users" ("email")
5636
+  (10.2ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
5637
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101221"]]
5638
+  (2.2ms) COMMIT
5639
+ Migrating to CreateProfiles (20160213101232)
5640
+  (0.1ms) BEGIN
5641
+  (21.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)
5642
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160213101232"]]
5643
+  (8.1ms) COMMIT
5644
+ Migrating to CreateComments (20160604081452)
5645
+  (0.1ms) BEGIN
5646
+  (26.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)
5647
+  (15.6ms) CREATE INDEX "index_comments_on_commentable_type_and_commentable_id" ON "comments" ("commentable_type", "commentable_id")
5648
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20160604081452"]]
5649
+  (8.0ms) COMMIT
5650
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5651
+  (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
5652
+ FROM pg_constraint c
5653
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5654
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5655
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5656
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5657
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5658
+ WHERE c.contype = 'f'
5659
+ AND t1.relname = 'comments'
5660
+ AND t3.nspname = ANY (current_schemas(false))
5661
+ ORDER BY c.conname
5662
+ 
5663
+  (1.0ms) 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
5664
+ FROM pg_constraint c
5665
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5666
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5667
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5668
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5669
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5670
+ WHERE c.contype = 'f'
5671
+ AND t1.relname = 'employers'
5672
+ AND t3.nspname = ANY (current_schemas(false))
5673
+ ORDER BY c.conname
5674
+
5675
+  (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
5676
+ FROM pg_constraint c
5677
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5678
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5679
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5680
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5681
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5682
+ WHERE c.contype = 'f'
5683
+ AND t1.relname = 'profiles'
5684
+ AND t3.nspname = ANY (current_schemas(false))
5685
+ ORDER BY c.conname
5686
+ 
5687
+  (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
5688
+ FROM pg_constraint c
5689
+ JOIN pg_class t1 ON c.conrelid = t1.oid
5690
+ JOIN pg_class t2 ON c.confrelid = t2.oid
5691
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
5692
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
5693
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
5694
+ WHERE c.contype = 'f'
5695
+ AND t1.relname = 'users'
5696
+ AND t3.nspname = ANY (current_schemas(false))
5697
+ ORDER BY c.conname
5698
+