diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-20 18:09:31 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-20 18:09:31 +0000 |
commit | ae4ef81757bdd2c984777d8f0b2c275bbcb4b17d (patch) | |
tree | 1ac23c80190bafb47a1f5a6f1aae9da91d35d9dc /db | |
parent | 194b499aa8e26df26ff70a1e1ce0396587bd5243 (diff) | |
download | gitlab-ce-ae4ef81757bdd2c984777d8f0b2c275bbcb4b17d.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
4 files changed, 79 insertions, 0 deletions
diff --git a/db/migrate/20200311154110_create_vulnerability_exports.rb b/db/migrate/20200311154110_create_vulnerability_exports.rb new file mode 100644 index 00000000000..f3162f8808c --- /dev/null +++ b/db/migrate/20200311154110_create_vulnerability_exports.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class CreateVulnerabilityExports < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :vulnerability_exports do |t| + t.timestamps_with_timezone null: false + t.datetime_with_timezone :started_at + t.datetime_with_timezone :finished_at + t.string :status, limit: 255, null: false + t.string :file, limit: 255 + t.bigint :project_id, null: false + t.bigint :author_id, null: false + t.integer :file_store + t.integer :format, limit: 2, null: false, default: 0 + + t.index %i[project_id id], unique: true + t.index %i[author_id] + end + end +end diff --git a/db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb b/db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb new file mode 100644 index 00000000000..23837f559d2 --- /dev/null +++ b/db/migrate/20200316173312_add_vulnerability_export_project_foreign_key.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddVulnerabilityExportProjectForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :vulnerability_exports, :projects, column: :project_id, on_delete: :cascade, index: false # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :vulnerability_exports, column: :project_id + end + end +end diff --git a/db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb b/db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb new file mode 100644 index 00000000000..032577f2f2a --- /dev/null +++ b/db/migrate/20200317142110_add_vulnerability_export_user_foreign_key.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddVulnerabilityExportUserForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :vulnerability_exports, :users, column: :author_id, on_delete: :cascade, index: false # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :vulnerability_exports, column: :author_id + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 74167ad30c4..98e6f0fb76a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -4535,6 +4535,21 @@ ActiveRecord::Schema.define(version: 2020_03_19_203901) do t.index ["updated_by_id"], name: "index_vulnerabilities_on_updated_by_id" end + create_table "vulnerability_exports", force: :cascade do |t| + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + t.datetime_with_timezone "started_at" + t.datetime_with_timezone "finished_at" + t.string "status", limit: 255, null: false + t.string "file", limit: 255 + t.bigint "project_id", null: false + t.bigint "author_id", null: false + t.integer "file_store" + t.integer "format", limit: 2, default: 0, null: false + t.index ["author_id"], name: "index_vulnerability_exports_on_author_id" + t.index ["project_id", "id"], name: "index_vulnerability_exports_on_project_id_and_id", unique: true + end + create_table "vulnerability_feedback", id: :serial, force: :cascade do |t| t.datetime_with_timezone "created_at", null: false t.datetime_with_timezone "updated_at", null: false @@ -5220,6 +5235,8 @@ ActiveRecord::Schema.define(version: 2020_03_19_203901) do add_foreign_key "vulnerabilities", "users", column: "last_edited_by_id", name: "fk_1302949740", on_delete: :nullify add_foreign_key "vulnerabilities", "users", column: "resolved_by_id", name: "fk_76bc5f5455", on_delete: :nullify add_foreign_key "vulnerabilities", "users", column: "updated_by_id", name: "fk_7ac31eacb9", on_delete: :nullify + add_foreign_key "vulnerability_exports", "projects", on_delete: :cascade + add_foreign_key "vulnerability_exports", "users", column: "author_id", on_delete: :cascade add_foreign_key "vulnerability_feedback", "ci_pipelines", column: "pipeline_id", on_delete: :nullify add_foreign_key "vulnerability_feedback", "issues", on_delete: :nullify add_foreign_key "vulnerability_feedback", "merge_requests", name: "fk_563ff1912e", on_delete: :nullify |