diff --git a/db/migrate/20180319190020_create_deploy_tokens.rb b/db/migrate/20180319190020_create_deploy_tokens.rb index 318ad3f0610c25fdc2709e011d3b18e35b5f6807..d129459ea0ac50c962135e9b114120cdf7f11bab 100644 --- a/db/migrate/20180319190020_create_deploy_tokens.rb +++ b/db/migrate/20180319190020_create_deploy_tokens.rb @@ -13,7 +13,7 @@ class CreateDeployTokens < ActiveRecord::Migration t.string :name, null: false t.string :token, index: { unique: true }, null: false - t.index [:token, :expires_at], where: "(revoked IS FALSE)" + t.index [:token, :expires_at, :id], where: "(revoked IS FALSE)" end end end diff --git a/db/schema.rb b/db/schema.rb index a50c5fba9691526f95239f5b00d6bcc93ebfcf6e..fd75b176318f7b4a9c46b7919d3f4615c7a96fef 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -693,7 +693,7 @@ ActiveRecord::Schema.define(version: 20180405142733) do t.string "token", null: false end - add_index "deploy_tokens", ["token", "expires_at"], name: "index_deploy_tokens_on_token_and_expires_at", where: "(revoked IS FALSE)", using: :btree + add_index "deploy_tokens", ["token", "expires_at", "id"], name: "index_deploy_tokens_on_token_and_expires_at_and_id", where: "(revoked IS FALSE)", using: :btree add_index "deploy_tokens", ["token"], name: "index_deploy_tokens_on_token", unique: true, using: :btree create_table "deployments", force: :cascade do |t|