From bae3701073783c0b6f2a831bb96413ea0f85b42e Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 2 Feb 2016 10:59:26 +0100 Subject: [PATCH] Add build eraseable columns to ci builds table --- app/models/ci/build.rb | 3 +++ db/migrate/20160202091601_add_eraseable_to_ci_build.rb | 8 ++++++++ db/schema.rb | 5 +++++ 3 files changed, 16 insertions(+) create mode 100644 db/migrate/20160202091601_add_eraseable_to_ci_build.rb diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 33bc412831..1d65aeb6ac 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -31,6 +31,9 @@ # artifacts_file :text # gl_project_id :integer # artifacts_metadata :text +# erased :boolean default(FALSE) +# erased_by_id :integer +# erased_at :datetime # module Ci diff --git a/db/migrate/20160202091601_add_eraseable_to_ci_build.rb b/db/migrate/20160202091601_add_eraseable_to_ci_build.rb new file mode 100644 index 0000000000..dcd8bcba32 --- /dev/null +++ b/db/migrate/20160202091601_add_eraseable_to_ci_build.rb @@ -0,0 +1,8 @@ +class AddEraseableToCiBuild < ActiveRecord::Migration + def change + add_column :ci_builds, :erased, :boolean, default: false + add_reference :ci_builds, :erased_by, references: :users, index: true + add_foreign_key :ci_builds, :users, column: :erased_by_id + add_column :ci_builds, :erased_at, :datetime + end +end diff --git a/db/schema.rb b/db/schema.rb index 689a8c3ecc..931f2ddf53 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -129,6 +129,9 @@ ActiveRecord::Schema.define(version: 20160209130428) do t.text "artifacts_file" t.integer "gl_project_id" t.text "artifacts_metadata" + t.boolean "erased", default: false + t.integer "erased_by_id" + t.datetime "erased_at" end add_index "ci_builds", ["commit_id", "stage_idx", "created_at"], name: "index_ci_builds_on_commit_id_and_stage_idx_and_created_at", using: :btree @@ -136,6 +139,7 @@ ActiveRecord::Schema.define(version: 20160209130428) do add_index "ci_builds", ["commit_id", "type", "name", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_name_and_ref", using: :btree add_index "ci_builds", ["commit_id", "type", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_ref", using: :btree add_index "ci_builds", ["commit_id"], name: "index_ci_builds_on_commit_id", using: :btree + add_index "ci_builds", ["erased_by_id"], name: "index_ci_builds_on_erased_by_id", using: :btree add_index "ci_builds", ["gl_project_id"], name: "index_ci_builds_on_gl_project_id", using: :btree add_index "ci_builds", ["project_id", "commit_id"], name: "index_ci_builds_on_project_id_and_commit_id", using: :btree add_index "ci_builds", ["project_id"], name: "index_ci_builds_on_project_id", using: :btree @@ -919,4 +923,5 @@ ActiveRecord::Schema.define(version: 20160209130428) do add_index "web_hooks", ["created_at", "id"], name: "index_web_hooks_on_created_at_and_id", using: :btree add_index "web_hooks", ["project_id"], name: "index_web_hooks_on_project_id", using: :btree + add_foreign_key "ci_builds", "users", column: "erased_by_id" end