diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-05-02 16:56:36 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-05-02 16:56:36 +0000 |
commit | 8f47aafe8387f10a5058b2f376cdfa82bb7052c9 (patch) | |
tree | 8472d6d9a23764d0742974010f628b3bc8ce2a25 | |
parent | b51b041695441889fd6e5d4f895c01e879f27e61 (diff) | |
parent | 0e8c12985f2bb5eb922905597ae10ab3dfae5ca7 (diff) | |
download | gitlab-ce-8f47aafe8387f10a5058b2f376cdfa82bb7052c9.tar.gz |
Merge branch '27777-drop-projects-ci_id-column-ee' into 'master'
Remove unused projects.ci_id column
See merge request gitlab-org/gitlab-ee!11580
-rw-r--r-- | app/models/project.rb | 1 | ||||
-rw-r--r-- | config/pseudonymizer.yml | 1 | ||||
-rw-r--r-- | db/post_migrate/20190424134256_drop_projects_ci_id.rb | 28 | ||||
-rw-r--r-- | db/schema.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/trace.rb | 14 | ||||
-rw-r--r-- | spec/support/shared_examples/ci_trace_shared_examples.rb | 39 |
6 files changed, 30 insertions, 55 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index b9448ce5421..d5313d027c2 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -56,6 +56,7 @@ class Project < ApplicationRecord VALID_MIRROR_PROTOCOLS = %w(http https ssh git).freeze ignore_column :import_status, :import_jid, :import_error + ignore_column :ci_id cache_markdown_field :description, pipeline: :description diff --git a/config/pseudonymizer.yml b/config/pseudonymizer.yml index f02604bae67..fc7dc8abdd9 100644 --- a/config/pseudonymizer.yml +++ b/config/pseudonymizer.yml @@ -379,7 +379,6 @@ tables: - issues_template - mirror - mirror_user_id - - ci_id - shared_runners_enabled - build_coverage_regex - build_allow_git_fetch diff --git a/db/post_migrate/20190424134256_drop_projects_ci_id.rb b/db/post_migrate/20190424134256_drop_projects_ci_id.rb new file mode 100644 index 00000000000..79fa9704f1f --- /dev/null +++ b/db/post_migrate/20190424134256_drop_projects_ci_id.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class DropProjectsCiId < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + disable_ddl_transaction! + + def up + if index_exists?(:projects, :ci_id) + remove_concurrent_index :projects, :ci_id + end + + if column_exists?(:projects, :ci_id) + remove_column :projects, :ci_id + end + end + + def down + add_column :projects, :ci_id, :integer + add_concurrent_index :projects, :ci_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 0e65ebd5788..d65290fbfd9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2502,7 +2502,6 @@ ActiveRecord::Schema.define(version: 20190426180107) do t.datetime "mirror_last_successful_update_at" t.integer "mirror_user_id" t.text "import_error" - t.integer "ci_id" t.boolean "shared_runners_enabled", default: true, null: false t.string "runners_token" t.string "build_coverage_regex" @@ -2552,7 +2551,6 @@ ActiveRecord::Schema.define(version: 20190426180107) do t.boolean "detected_repository_languages" t.boolean "merge_requests_disable_committers_approval" t.index ["archived", "pending_delete", "merge_requests_require_code_owner_approval"], name: "projects_requiring_code_owner_approval", where: "((pending_delete = false) AND (archived = false) AND (merge_requests_require_code_owner_approval = true))", using: :btree - t.index ["ci_id"], name: "index_projects_on_ci_id", using: :btree t.index ["created_at"], name: "index_projects_on_created_at", using: :btree t.index ["creator_id"], name: "index_projects_on_creator_id", using: :btree t.index ["description"], name: "index_projects_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"} diff --git a/lib/gitlab/ci/trace.rb b/lib/gitlab/ci/trace.rb index bf5f2a31f0e..dfae260239e 100644 --- a/lib/gitlab/ci/trace.rb +++ b/lib/gitlab/ci/trace.rb @@ -209,10 +209,7 @@ module Gitlab end def paths - [ - default_path, - deprecated_path - ].compact + [default_path] end def default_directory @@ -227,15 +224,6 @@ module Gitlab File.join(default_directory, "#{job.id}.log") end - def deprecated_path - File.join( - Settings.gitlab_ci.builds_path, - job.created_at.utc.strftime("%Y_%m"), - job.project.ci_id.to_s, - "#{job.id}.log" - ) if job.project&.ci_id - end - def trace_artifact job.job_artifacts_trace end diff --git a/spec/support/shared_examples/ci_trace_shared_examples.rb b/spec/support/shared_examples/ci_trace_shared_examples.rb index c603421d748..db935bcb388 100644 --- a/spec/support/shared_examples/ci_trace_shared_examples.rb +++ b/spec/support/shared_examples/ci_trace_shared_examples.rb @@ -329,14 +329,6 @@ shared_examples_for 'trace with disabled live trace feature' do it_behaves_like 'read successfully with IO' end - context 'when current_path (with project_ci_id) exists' do - before do - expect(trace).to receive(:deprecated_path) { expand_fixture_path('trace/sample_trace') } - end - - it_behaves_like 'read successfully with IO' - end - context 'when db trace exists' do before do build.send(:write_attribute, :trace, "data") @@ -396,37 +388,6 @@ shared_examples_for 'trace with disabled live trace feature' do end end - context 'deprecated path' do - let(:path) { trace.send(:deprecated_path) } - - context 'with valid ci_id' do - before do - build.project.update(ci_id: 1000) - - FileUtils.mkdir_p(File.dirname(path)) - - File.open(path, "w") do |file| - file.write("data") - end - end - - it "trace exist" do - expect(trace.exist?).to be(true) - end - - it "can be erased" do - trace.erase! - expect(trace.exist?).to be(false) - end - end - - context 'without valid ci_id' do - it "does not return deprecated path" do - expect(path).to be_nil - end - end - end - context 'stored in database' do before do build.send(:write_attribute, :trace, "data") |