Commit 73f87244 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Use partial NOT NULL index for token_encrypted field

parent 6de0eb03
......@@ -8,7 +8,7 @@ class AddIndexToCiBuildsTokenEncrypted < ActiveRecord::Migration[5.0]
disable_ddl_transaction!
def up
add_concurrent_index :ci_builds, :token_encrypted, unique: true
add_concurrent_index :ci_builds, :token_encrypted, unique: true, where: 'token_encrypted IS NOT NULL'
end
def down
......
......@@ -361,7 +361,7 @@ ActiveRecord::Schema.define(version: 20181129104944) do
t.index ["stage_id"], name: "index_ci_builds_on_stage_id", using: :btree
t.index ["status", "type", "runner_id"], name: "index_ci_builds_on_status_and_type_and_runner_id", using: :btree
t.index ["token"], name: "index_ci_builds_on_token", unique: true, using: :btree
t.index ["token_encrypted"], name: "index_ci_builds_on_token_encrypted", unique: true, using: :btree
t.index ["token_encrypted"], name: "index_ci_builds_on_token_encrypted", unique: true, where: "(token_encrypted IS NOT NULL)", using: :btree
t.index ["updated_at"], name: "index_ci_builds_on_updated_at", using: :btree
t.index ["user_id"], name: "index_ci_builds_on_user_id", using: :btree
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment