summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-03-02 04:45:37 +0800
committerLin Jen-Shin <godfat@godfat.org>2017-03-02 05:09:37 +0800
commitcc0e2cff96f917f62210a29554ca0b1e26f31748 (patch)
tree41b32a9a5eda527f214f123f559a58da38af619e
parentb6a945b39354ec2b2c09fc5f6904dfbf8990df26 (diff)
downloadgitlab-ce-rename-ci_commits-to-ci_pipeline.tar.gz
Rename table ci_commits to ci_pipelinesrename-ci_commits-to-ci_pipeline
-rw-r--r--app/models/ci/pipeline.rb2
-rw-r--r--changelogs/unreleased/rename-ci_commits-to-ci_pipeline.yml4
-rw-r--r--db/migrate/20170301195939_rename_ci_commits_to_ci_pipelines.rb10
-rw-r--r--db/schema.rb56
4 files changed, 42 insertions, 30 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 80e11a5b58f..9df2ca5b551 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -5,8 +5,6 @@ module Ci
include Importable
include AfterCommitQueue
- self.table_name = 'ci_commits'
-
belongs_to :project, foreign_key: :gl_project_id
belongs_to :user
diff --git a/changelogs/unreleased/rename-ci_commits-to-ci_pipeline.yml b/changelogs/unreleased/rename-ci_commits-to-ci_pipeline.yml
new file mode 100644
index 00000000000..4067b3de00c
--- /dev/null
+++ b/changelogs/unreleased/rename-ci_commits-to-ci_pipeline.yml
@@ -0,0 +1,4 @@
+---
+title: Rename table ci_commits to ci_pipelines
+merge_request: 9638
+author:
diff --git a/db/migrate/20170301195939_rename_ci_commits_to_ci_pipelines.rb b/db/migrate/20170301195939_rename_ci_commits_to_ci_pipelines.rb
new file mode 100644
index 00000000000..4f061d96392
--- /dev/null
+++ b/db/migrate/20170301195939_rename_ci_commits_to_ci_pipelines.rb
@@ -0,0 +1,10 @@
+class RenameCiCommitsToCiPipelines < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = true
+ DOWNTIME_REASON = 'Rename table ci_commits to ci_pipelines'
+
+ def change
+ rename_table 'ci_commits', 'ci_pipelines'
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index cd5aa339269..29d9dd12257 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: 20170217151947) do
+ActiveRecord::Schema.define(version: 20170301195939) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -232,32 +232,6 @@ ActiveRecord::Schema.define(version: 20170217151947) do
add_index "ci_builds", ["status"], name: "index_ci_builds_on_status", using: :btree
add_index "ci_builds", ["token"], name: "index_ci_builds_on_token", unique: true, using: :btree
- create_table "ci_commits", force: :cascade do |t|
- t.integer "project_id"
- t.string "ref"
- t.string "sha"
- t.string "before_sha"
- t.text "push_data"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.boolean "tag", default: false
- t.text "yaml_errors"
- t.datetime "committed_at"
- t.integer "gl_project_id"
- t.string "status"
- t.datetime "started_at"
- t.datetime "finished_at"
- t.integer "duration"
- t.integer "user_id"
- t.integer "lock_version"
- end
-
- add_index "ci_commits", ["gl_project_id", "ref", "status"], name: "index_ci_commits_on_gl_project_id_and_ref_and_status", using: :btree
- add_index "ci_commits", ["gl_project_id", "sha"], name: "index_ci_commits_on_gl_project_id_and_sha", using: :btree
- add_index "ci_commits", ["gl_project_id"], name: "index_ci_commits_on_gl_project_id", using: :btree
- add_index "ci_commits", ["status"], name: "index_ci_commits_on_status", using: :btree
- add_index "ci_commits", ["user_id"], name: "index_ci_commits_on_user_id", using: :btree
-
create_table "ci_events", force: :cascade do |t|
t.integer "project_id"
t.integer "user_id"
@@ -281,6 +255,32 @@ ActiveRecord::Schema.define(version: 20170217151947) do
t.datetime "deleted_at"
end
+ create_table "ci_pipelines", force: :cascade do |t|
+ t.integer "project_id"
+ t.string "ref"
+ t.string "sha"
+ t.string "before_sha"
+ t.text "push_data"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.boolean "tag", default: false
+ t.text "yaml_errors"
+ t.datetime "committed_at"
+ t.integer "gl_project_id"
+ t.string "status"
+ t.datetime "started_at"
+ t.datetime "finished_at"
+ t.integer "duration"
+ t.integer "user_id"
+ t.integer "lock_version"
+ end
+
+ add_index "ci_pipelines", ["gl_project_id", "ref", "status"], name: "index_ci_pipelines_on_gl_project_id_and_ref_and_status", using: :btree
+ add_index "ci_pipelines", ["gl_project_id", "sha"], name: "index_ci_pipelines_on_gl_project_id_and_sha", using: :btree
+ add_index "ci_pipelines", ["gl_project_id"], name: "index_ci_pipelines_on_gl_project_id", using: :btree
+ add_index "ci_pipelines", ["status"], name: "index_ci_pipelines_on_status", using: :btree
+ add_index "ci_pipelines", ["user_id"], name: "index_ci_pipelines_on_user_id", using: :btree
+
create_table "ci_projects", force: :cascade do |t|
t.string "name"
t.integer "timeout", default: 3600, null: false
@@ -1339,7 +1339,7 @@ ActiveRecord::Schema.define(version: 20170217151947) do
add_foreign_key "labels", "namespaces", column: "group_id", on_delete: :cascade
add_foreign_key "lists", "boards"
add_foreign_key "lists", "labels"
- add_foreign_key "merge_request_metrics", "ci_commits", column: "pipeline_id", on_delete: :cascade
+ add_foreign_key "merge_request_metrics", "ci_pipelines", column: "pipeline_id", on_delete: :cascade
add_foreign_key "merge_request_metrics", "merge_requests", on_delete: :cascade
add_foreign_key "merge_requests_closing_issues", "issues", on_delete: :cascade
add_foreign_key "merge_requests_closing_issues", "merge_requests", on_delete: :cascade