active_record_doctor 1.0.2 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5905a5c62589cb50dcd33a9c016b8662995d86bd
4
- data.tar.gz: e5bd8bf894d6202b8752fa414cad9f330ecc9c7e
3
+ metadata.gz: be1694f7ee06ee05eb0381bea35f5a1446e067ab
4
+ data.tar.gz: 7e781c490ba3276e6bae081d911b7ffc9e2795a3
5
5
  SHA512:
6
- metadata.gz: c29856aae90e13ec1f52e82740fb8cd3a8232fc494d7793e1a6a308af47d7c4aac56dd2fb19fba0b52ef7fdca751b732a0bcbfa0b54680d144cbf104a815ec95
7
- data.tar.gz: aed214ddccfbcfccf6029dc7fcb52fa8eef8fc0ad4f423f6c59859d29fb06d80fb51e6b7846072856295b3d1ef5d2212e4d8e3ffb8ebbec6522292db7cbf3b66
6
+ metadata.gz: 8d30f1aad3a7469e7d0a693bae9254781875025086d3762487c70c5e740d12c9212bfe651f77a8c3b732a93b8d2a748921a654622e851b044882baa6907d9845
7
+ data.tar.gz: 6dae1b721f9e19573935fc1ca883c5d3fd4a0c73c63d97db9171300259c96cb287a3edf08913a7a56b9dd4c51120308192827083aaeefa930cff6c08470d480a
data/README.rdoc CHANGED
@@ -1,7 +1,14 @@
1
1
  = Active Record Doctor
2
2
 
3
3
  Active Record Doctor helps to keep the database in a good shape. Currently, it
4
- can index unindexed foreign keys. More features coming soon!
4
+ can:
5
+
6
+ * index unindexed foreign keys
7
+ * detect extraneous indexes
8
+
9
+ More features coming soon!
10
+
11
+ Want to suggest a feature? Just shoot me {an email}[mailto:contact@gregnavis.com].
5
12
 
6
13
  {<img src="https://travis-ci.org/gregnavis/active_record_doctor.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/gregnavis/active_record_doctor]
7
14
 
@@ -10,9 +17,7 @@ can index unindexed foreign keys. More features coming soon!
10
17
  The preferred installation method is adding +active_record_doctor+ to your
11
18
  +Gemfile+:
12
19
 
13
- # git: is required as the gem hasn't been released yet
14
- gem 'active_record_doctor', group: :development,
15
- github: 'gregnavis/active-record-doctor'
20
+ gem 'active_record_doctor', group: :development
16
21
 
17
22
  Then run:
18
23
 
@@ -43,6 +48,37 @@ three-step process:
43
48
 
44
49
  rake db:migrate
45
50
 
51
+ === Removing Extraneous Indexes
52
+
53
+ Let me illustrate with an example. Consider a +users+ table with columns
54
+ +first_name+ and +last_name+. If there are two indexes:
55
+
56
+ * A two-column index on +last_name, first_name+.
57
+ * A single-column index on +last_name+.
58
+
59
+ Then the latter index can be dropped as the former can play its role. In
60
+ general, a multi-column index on +column_1, column_2, ..., column_n+ can replace
61
+ indexes on:
62
+
63
+ * +column_1+
64
+ * +column_1+, +column_2+
65
+ * ...
66
+ * +column_1+, +column_2+, ..., +column_(n - 1)+
67
+
68
+ To discover such indexes automatically just follow these steps:
69
+
70
+ 1. List extraneous indexes by running:
71
+
72
+ rake active_record_doctor:extraneous_indexes
73
+
74
+ 2. Confirm that each of the indexes can be indeed dropped.
75
+
76
+ 3. Create a migration to drop the indexes.
77
+
78
+ The indexes aren't dropped automatically because there's usually just a few of
79
+ them and it's a good idea to double-check that you won't drop something
80
+ necessary.
81
+
46
82
  == Author
47
83
 
48
84
  This gem is developed and maintained by {Greg Navis}[http://www.gregnavis.com].
@@ -10,6 +10,17 @@ module ActiveRecordDoctor
10
10
  "#{table} #{columns.sort.join(' ')}"
11
11
  end.join("\n"))
12
12
  end
13
+
14
+ def print_extraneous_indexes(extraneous_indexes)
15
+ if extraneous_indexes.empty?
16
+ @io.puts("No indexes are extraneous.")
17
+ else
18
+ @io.puts("The following indexes are extraneous and can be removed:")
19
+ extraneous_indexes.each do |index, super_index|
20
+ @io.puts(" #{index} (can be handled by #{super_index})")
21
+ end
22
+ end
23
+ end
13
24
  end
14
25
  end
15
26
  end
@@ -0,0 +1,63 @@
1
+ require "active_record_doctor/printers/io_printer"
2
+
3
+ module ActiveRecordDoctor
4
+ module Tasks
5
+ class ExtraneousIndexes
6
+ def self.run
7
+ new.run
8
+ end
9
+
10
+ def initialize(printer: ActiveRecordDoctor::Printers::IOPrinter.new)
11
+ @printer = printer
12
+ end
13
+
14
+ def run
15
+ @printer.print_extraneous_indexes(extraneous_indexes)
16
+ end
17
+
18
+ private
19
+
20
+ def extraneous_indexes
21
+ @extraneous_indexes ||=
22
+ tables.reject do |table|
23
+ "schema_migrations" == table
24
+ end.map do |table|
25
+ indexes = indexes(table)
26
+ maximum_indexes = indexes.select do |index|
27
+ indexes.all? do |another_index|
28
+ index == another_index || !prefix?(index, another_index)
29
+ end
30
+ end
31
+
32
+ indexes.reject do |index|
33
+ maximum_indexes.include?(index)
34
+ end.map do |extraneous_index|
35
+ [
36
+ extraneous_index.name,
37
+ maximum_indexes.find do |maximum_index|
38
+ prefix?(extraneous_index, maximum_index)
39
+ end.name
40
+ ]
41
+ end
42
+ end.flatten(1)
43
+ end
44
+
45
+ def prefix?(lhs, rhs)
46
+ lhs.columns.count <= rhs.columns.count &&
47
+ rhs.columns[0...lhs.columns.count] == lhs.columns
48
+ end
49
+
50
+ def indexes(table_name)
51
+ @connection.indexes(table_name)
52
+ end
53
+
54
+ def tables
55
+ @tables ||= connection.tables
56
+ end
57
+
58
+ def connection
59
+ @connection ||= ActiveRecord::Base.connection
60
+ end
61
+ end
62
+ end
63
+ end
@@ -18,7 +18,7 @@ module ActiveRecordDoctor
18
18
  private
19
19
 
20
20
  def unindexed_foreign_keys
21
- connection.tables.select do |table|
21
+ hash_from_pairs(connection.tables.select do |table|
22
22
  "schema_migrations" != table
23
23
  end.map do |table|
24
24
  [
@@ -29,7 +29,7 @@ module ActiveRecordDoctor
29
29
  ]
30
30
  end.select do |table, columns|
31
31
  !columns.empty?
32
- end.to_h
32
+ end)
33
33
  end
34
34
 
35
35
  def foreign_key?(table, column)
@@ -45,6 +45,10 @@ module ActiveRecordDoctor
45
45
  def connection
46
46
  @connection ||= ActiveRecord::Base.connection
47
47
  end
48
+
49
+ def hash_from_pairs(pairs)
50
+ Hash[*pairs.flatten(1)]
51
+ end
48
52
  end
49
53
  end
50
54
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordDoctor
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -1,7 +1,12 @@
1
1
  require "active_record_doctor/tasks/unindexed_foreign_keys"
2
+ require "active_record_doctor/tasks/extraneous_indexes"
2
3
 
3
4
  namespace :active_record_doctor do
4
5
  task :unindexed_foreign_keys => :environment do
5
6
  ActiveRecordDoctor::Tasks::UnindexedForeignKeys.run
6
7
  end
8
+
9
+ task :extraneous_indexes => :environment do
10
+ ActiveRecordDoctor::Tasks::ExtraneousIndexes.run
11
+ end
7
12
  end
@@ -0,0 +1,25 @@
1
+ require 'test_helper'
2
+
3
+ require 'active_record_doctor/tasks/extraneous_indexes'
4
+
5
+ class ActiveRecordDoctor::Tasks::ExtraneousIndexesTest < ActiveSupport::TestCase
6
+ def test_extraneous_indexes_are_reported
7
+ result = run_task
8
+
9
+ assert_equal(
10
+ result.sort,
11
+ [
12
+ ["index_users_on_last_name_and_first_name", "index_users_on_last_name_and_first_name_and_email"],
13
+ ["index_users_on_last_name", "index_users_on_last_name_and_first_name_and_email"]
14
+ ].sort
15
+ )
16
+ end
17
+
18
+ private
19
+
20
+ def run_task
21
+ printer = SpyPrinter.new
22
+ ActiveRecordDoctor::Tasks::ExtraneousIndexes.new(printer: printer).run
23
+ printer.extraneous_indexes
24
+ end
25
+ end
@@ -6,7 +6,7 @@ class ActiveRecordDoctor::Tasks::UnindexedForeignKeysTest < ActiveSupport::TestC
6
6
  def test_unindexed_foreign_keys_are_reported
7
7
  result = run_task
8
8
 
9
- assert_equal([{ "users" => ["profile_id"] }], result)
9
+ assert_equal({ "users" => ["profile_id"] }, result)
10
10
  end
11
11
 
12
12
  private
Binary file
@@ -2,12 +2,17 @@ class CreateUsers < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :users do |t|
4
4
  t.string :email
5
+ t.string :first_name
6
+ t.string :last_name
5
7
  t.references :profile, foreign_key: true
6
8
  t.references :employer, foreign_key: true
7
9
  t.string :country_code, null: false
8
10
 
9
11
  t.timestamps null: false
10
12
  end
13
+ add_index :users, [:last_name, :first_name, :email]
14
+ add_index :users, [:last_name, :first_name]
15
+ add_index :users, :last_name
11
16
  add_index :users, :email, unique: true
12
17
  add_index :users, [:employer_id, :country_code]
13
18
  end
@@ -28,6 +28,8 @@ ActiveRecord::Schema.define(version: 20160213102131) do
28
28
 
29
29
  create_table "users", force: :cascade do |t|
30
30
  t.string "email"
31
+ t.string "first_name"
32
+ t.string "last_name"
31
33
  t.integer "profile_id"
32
34
  t.integer "employer_id"
33
35
  t.string "country_code", null: false
@@ -37,5 +39,8 @@ ActiveRecord::Schema.define(version: 20160213102131) do
37
39
 
38
40
  add_index "users", ["email"], name: "index_users_on_email", unique: true
39
41
  add_index "users", ["employer_id", "country_code"], name: "index_users_on_employer_id_and_country_code"
42
+ add_index "users", ["last_name", "first_name", "email"], name: "index_users_on_last_name_and_first_name_and_email"
43
+ add_index "users", ["last_name", "first_name"], name: "index_users_on_last_name_and_first_name"
44
+ add_index "users", ["last_name"], name: "index_users_on_last_name"
40
45
 
41
46
  end
Binary file
@@ -652,3 +652,308 @@ Migrating to IndexForeignKeysInUsers (20160402143434)
652
652
  FROM sqlite_temp_master
653
653
  WHERE name='index_users_on_email' AND type='index'
654
654
 
655
+  (30.9ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
656
+  (0.0ms) select sqlite_version(*)
657
+  (35.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
658
+ ActiveRecord::SchemaMigration Load (0.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
659
+ Migrating to CreateUsers (20160213101213)
660
+  (0.0ms) begin transaction
661
+  (0.2ms) 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)
662
+  (0.1ms) CREATE INDEX "index_users_on_last_name_and_first_name_and_email" ON "users" ("last_name", "first_name", "email")
663
+  (0.1ms) SELECT sql
664
+ FROM sqlite_master
665
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
666
+ UNION ALL
667
+ SELECT sql
668
+ FROM sqlite_temp_master
669
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
670
+
671
+  (0.1ms) CREATE INDEX "index_users_on_last_name_and_first_name" ON "users" ("last_name", "first_name")
672
+  (0.0ms) SELECT sql
673
+ FROM sqlite_master
674
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
675
+ UNION ALL
676
+ SELECT sql
677
+ FROM sqlite_temp_master
678
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
679
+
680
+  (0.0ms)  SELECT sql
681
+ FROM sqlite_master
682
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
683
+ UNION ALL
684
+ SELECT sql
685
+ FROM sqlite_temp_master
686
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
687
+ 
688
+  (0.1ms) CREATE INDEX "index_users_on_last_name" ON "users" ("last_name")
689
+  (0.0ms)  SELECT sql
690
+ FROM sqlite_master
691
+ WHERE name='index_users_on_last_name' AND type='index'
692
+ UNION ALL
693
+ SELECT sql
694
+ FROM sqlite_temp_master
695
+ WHERE name='index_users_on_last_name' AND type='index'
696
+ 
697
+  (0.0ms) SELECT sql
698
+ FROM sqlite_master
699
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
700
+ UNION ALL
701
+ SELECT sql
702
+ FROM sqlite_temp_master
703
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
704
+
705
+  (0.0ms)  SELECT sql
706
+ FROM sqlite_master
707
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
708
+ UNION ALL
709
+ SELECT sql
710
+ FROM sqlite_temp_master
711
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
712
+ 
713
+  (0.1ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
714
+  (0.0ms)  SELECT sql
715
+ FROM sqlite_master
716
+ WHERE name='index_users_on_email' AND type='index'
717
+ UNION ALL
718
+ SELECT sql
719
+ FROM sqlite_temp_master
720
+ WHERE name='index_users_on_email' AND type='index'
721
+ 
722
+  (0.0ms) SELECT sql
723
+ FROM sqlite_master
724
+ WHERE name='index_users_on_last_name' AND type='index'
725
+ UNION ALL
726
+ SELECT sql
727
+ FROM sqlite_temp_master
728
+ WHERE name='index_users_on_last_name' AND type='index'
729
+
730
+  (0.0ms)  SELECT sql
731
+ FROM sqlite_master
732
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
733
+ UNION ALL
734
+ SELECT sql
735
+ FROM sqlite_temp_master
736
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
737
+ 
738
+  (0.0ms) SELECT sql
739
+ FROM sqlite_master
740
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
741
+ UNION ALL
742
+ SELECT sql
743
+ FROM sqlite_temp_master
744
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
745
+
746
+  (0.1ms) CREATE INDEX "index_users_on_employer_id_and_country_code" ON "users" ("employer_id", "country_code")
747
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160213101213"]]
748
+  (28.3ms) commit transaction
749
+ Migrating to CreateProfiles (20160213101232)
750
+  (0.1ms) begin transaction
751
+  (0.2ms) 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) 
752
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160213101232"]]
753
+  (33.6ms) commit transaction
754
+ Migrating to CreateEmployers (20160213102131)
755
+  (0.0ms) begin transaction
756
+  (0.2ms) CREATE TABLE "employers" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
757
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20160213102131"]]
758
+  (19.2ms) commit transaction
759
+ ActiveRecord::SchemaMigration Load (0.0ms) SELECT "schema_migrations".* FROM "schema_migrations"
760
+  (0.1ms)  SELECT sql
761
+ FROM sqlite_master
762
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
763
+ UNION ALL
764
+ SELECT sql
765
+ FROM sqlite_temp_master
766
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
767
+ 
768
+  (0.0ms) SELECT sql
769
+ FROM sqlite_master
770
+ WHERE name='index_users_on_email' AND type='index'
771
+ UNION ALL
772
+ SELECT sql
773
+ FROM sqlite_temp_master
774
+ WHERE name='index_users_on_email' AND type='index'
775
+
776
+  (0.0ms)  SELECT sql
777
+ FROM sqlite_master
778
+ WHERE name='index_users_on_last_name' AND type='index'
779
+ UNION ALL
780
+ SELECT sql
781
+ FROM sqlite_temp_master
782
+ WHERE name='index_users_on_last_name' AND type='index'
783
+ 
784
+  (0.0ms) SELECT sql
785
+ FROM sqlite_master
786
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
787
+ UNION ALL
788
+ SELECT sql
789
+ FROM sqlite_temp_master
790
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
791
+
792
+  (0.0ms)  SELECT sql
793
+ FROM sqlite_master
794
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
795
+ UNION ALL
796
+ SELECT sql
797
+ FROM sqlite_temp_master
798
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
799
+ 
800
+  (0.1ms)  SELECT sql
801
+ FROM sqlite_master
802
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
803
+ UNION ALL
804
+ SELECT sql
805
+ FROM sqlite_temp_master
806
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
807
+ 
808
+  (0.0ms) SELECT sql
809
+ FROM sqlite_master
810
+ WHERE name='index_users_on_email' AND type='index'
811
+ UNION ALL
812
+ SELECT sql
813
+ FROM sqlite_temp_master
814
+ WHERE name='index_users_on_email' AND type='index'
815
+
816
+  (0.0ms)  SELECT sql
817
+ FROM sqlite_master
818
+ WHERE name='index_users_on_last_name' AND type='index'
819
+ UNION ALL
820
+ SELECT sql
821
+ FROM sqlite_temp_master
822
+ WHERE name='index_users_on_last_name' AND type='index'
823
+ 
824
+  (0.0ms) SELECT sql
825
+ FROM sqlite_master
826
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
827
+ UNION ALL
828
+ SELECT sql
829
+ FROM sqlite_temp_master
830
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
831
+
832
+  (0.0ms)  SELECT sql
833
+ FROM sqlite_master
834
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
835
+ UNION ALL
836
+ SELECT sql
837
+ FROM sqlite_temp_master
838
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
839
+ 
840
+  (0.1ms)  SELECT sql
841
+ FROM sqlite_master
842
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
843
+ UNION ALL
844
+ SELECT sql
845
+ FROM sqlite_temp_master
846
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
847
+ 
848
+  (0.0ms) SELECT sql
849
+ FROM sqlite_master
850
+ WHERE name='index_users_on_email' AND type='index'
851
+ UNION ALL
852
+ SELECT sql
853
+ FROM sqlite_temp_master
854
+ WHERE name='index_users_on_email' AND type='index'
855
+
856
+  (0.0ms)  SELECT sql
857
+ FROM sqlite_master
858
+ WHERE name='index_users_on_last_name' AND type='index'
859
+ UNION ALL
860
+ SELECT sql
861
+ FROM sqlite_temp_master
862
+ WHERE name='index_users_on_last_name' AND type='index'
863
+ 
864
+  (0.0ms) SELECT sql
865
+ FROM sqlite_master
866
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
867
+ UNION ALL
868
+ SELECT sql
869
+ FROM sqlite_temp_master
870
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
871
+
872
+  (0.1ms)  SELECT sql
873
+ FROM sqlite_master
874
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
875
+ UNION ALL
876
+ SELECT sql
877
+ FROM sqlite_temp_master
878
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
879
+ 
880
+  (0.1ms)  SELECT sql
881
+ FROM sqlite_master
882
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
883
+ UNION ALL
884
+ SELECT sql
885
+ FROM sqlite_temp_master
886
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
887
+ 
888
+  (0.0ms) SELECT sql
889
+ FROM sqlite_master
890
+ WHERE name='index_users_on_email' AND type='index'
891
+ UNION ALL
892
+ SELECT sql
893
+ FROM sqlite_temp_master
894
+ WHERE name='index_users_on_email' AND type='index'
895
+
896
+  (0.1ms)  SELECT sql
897
+ FROM sqlite_master
898
+ WHERE name='index_users_on_last_name' AND type='index'
899
+ UNION ALL
900
+ SELECT sql
901
+ FROM sqlite_temp_master
902
+ WHERE name='index_users_on_last_name' AND type='index'
903
+ 
904
+  (0.1ms) SELECT sql
905
+ FROM sqlite_master
906
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
907
+ UNION ALL
908
+ SELECT sql
909
+ FROM sqlite_temp_master
910
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
911
+
912
+  (0.1ms)  SELECT sql
913
+ FROM sqlite_master
914
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
915
+ UNION ALL
916
+ SELECT sql
917
+ FROM sqlite_temp_master
918
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
919
+ 
920
+  (0.1ms)  SELECT sql
921
+ FROM sqlite_master
922
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
923
+ UNION ALL
924
+ SELECT sql
925
+ FROM sqlite_temp_master
926
+ WHERE name='index_users_on_employer_id_and_country_code' AND type='index'
927
+ 
928
+  (0.1ms) SELECT sql
929
+ FROM sqlite_master
930
+ WHERE name='index_users_on_email' AND type='index'
931
+ UNION ALL
932
+ SELECT sql
933
+ FROM sqlite_temp_master
934
+ WHERE name='index_users_on_email' AND type='index'
935
+
936
+  (0.0ms)  SELECT sql
937
+ FROM sqlite_master
938
+ WHERE name='index_users_on_last_name' AND type='index'
939
+ UNION ALL
940
+ SELECT sql
941
+ FROM sqlite_temp_master
942
+ WHERE name='index_users_on_last_name' AND type='index'
943
+ 
944
+  (0.0ms) SELECT sql
945
+ FROM sqlite_master
946
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
947
+ UNION ALL
948
+ SELECT sql
949
+ FROM sqlite_temp_master
950
+ WHERE name='index_users_on_last_name_and_first_name' AND type='index'
951
+
952
+  (0.0ms)  SELECT sql
953
+ FROM sqlite_master
954
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
955
+ UNION ALL
956
+ SELECT sql
957
+ FROM sqlite_temp_master
958
+ WHERE name='index_users_on_last_name_and_first_name_and_email' AND type='index'
959
+