Skip to content

Commit

Permalink
Merge pull request #559 from dxw/add-index-to-submissions-created-at
Browse files Browse the repository at this point in the history
Add missing index on 'submissions.created_at'
  • Loading branch information
edavey authored Dec 9, 2019
2 parents 90e6987 + ee9e5a1 commit 651fb50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions db/migrate/20191204094848_add_index_on_submissions_created_at.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class AddIndexOnSubmissionsCreatedAt < ActiveRecord::Migration[5.2]
disable_ddl_transaction!

def change
add_index :submissions,
:created_at,
order: { created_at: :desc },
algorithm: :concurrently
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2019_10_23_072354) do
ActiveRecord::Schema.define(version: 2019_12_04_094848) do

# These are extensions that must be enabled in order to support this database
enable_extension "citext"
Expand Down Expand Up @@ -172,6 +172,7 @@
t.decimal "management_charge_total", precision: 18, scale: 4
t.decimal "invoice_total", precision: 18, scale: 4
t.index ["aasm_state"], name: "index_submissions_on_aasm_state"
t.index ["created_at"], name: "index_submissions_on_created_at", order: :desc
t.index ["created_by_id"], name: "index_submissions_on_created_by_id"
t.index ["framework_id"], name: "index_submissions_on_framework_id"
t.index ["submitted_by_id"], name: "index_submissions_on_submitted_by_id"
Expand Down

0 comments on commit 651fb50

Please sign in to comment.