Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-01-25 14:55:11 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-01-25 14:55:11 +0300
commitb97b4d258552cadc55f408a28569c4a0d34b38a3 (patch)
treeecd13a773dd2aa23bdf221b6e421829d52122015 /db
parentce71b1ce072b024802e7e4ff07486e253c24d964 (diff)
Add an unique index on pipeline stage name
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20180125111139_add_unique_pipeline_stage_name_index.rb17
-rw-r--r--db/schema.rb5
2 files changed, 20 insertions, 2 deletions
diff --git a/db/post_migrate/20180125111139_add_unique_pipeline_stage_name_index.rb b/db/post_migrate/20180125111139_add_unique_pipeline_stage_name_index.rb
new file mode 100644
index 00000000000..4fa148b2446
--- /dev/null
+++ b/db/post_migrate/20180125111139_add_unique_pipeline_stage_name_index.rb
@@ -0,0 +1,17 @@
+class AddUniquePipelineStageNameIndex < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index :ci_stages, [:pipeline_id, :name]
+ add_concurrent_index :ci_stages, [:pipeline_id, :name], unique: true
+ end
+
+ def down
+ remove_concurrent_index :ci_stages, [:pipeline_id, :name], unique: true
+ add_concurrent_index :ci_stages, [:pipeline_id, :name]
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 9becd794553..d0802bed8f7 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20180119121225) do
+ActiveRecord::Schema.define(version: 20180125111139) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -450,7 +450,8 @@ ActiveRecord::Schema.define(version: 20180119121225) do
t.integer "lock_version"
end
- add_index "ci_stages", ["pipeline_id", "name"], name: "index_ci_stages_on_pipeline_id_and_name", using: :btree
+ add_index "ci_stages", ["pipeline_id", "name"], name: "index_ci_stages_on_pipeline_id_and_name", unique: true, using: :btree
+ add_index "ci_stages", ["pipeline_id", "name"], name: "index_ci_stages_on_pipeline_id_and_name_unique", unique: true, using: :btree
add_index "ci_stages", ["pipeline_id"], name: "index_ci_stages_on_pipeline_id", using: :btree
add_index "ci_stages", ["project_id"], name: "index_ci_stages_on_project_id", using: :btree