From 76623c12c136f43f24c3966ed4b469e2c0b434b7 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 5 Feb 2020 21:09:02 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- db/migrate/20200203232433_create_security_scan.rb | 24 +++++++++++++++++++++++ db/schema.rb | 10 ++++++++++ 2 files changed, 34 insertions(+) create mode 100644 db/migrate/20200203232433_create_security_scan.rb (limited to 'db') diff --git a/db/migrate/20200203232433_create_security_scan.rb b/db/migrate/20200203232433_create_security_scan.rb new file mode 100644 index 00000000000..a5fe73efbf2 --- /dev/null +++ b/db/migrate/20200203232433_create_security_scan.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class CreateSecurityScan < ActiveRecord::Migration[5.2] + DOWNTIME = false + + def change + create_table :security_scans, id: :bigserial do |t| + t.timestamps_with_timezone null: false + + t.references :build, + null: false, + index: false, + foreign_key: { to_table: :ci_builds, on_delete: :cascade }, + type: :bigint + + t.integer :scan_type, + null: false, + index: { name: "idx_security_scans_on_scan_type" }, + limit: 2 + + t.index [:build_id, :scan_type], name: "idx_security_scans_on_build_and_scan_type", unique: true + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 258530ac3b3..0fa15317003 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -3737,6 +3737,15 @@ ActiveRecord::Schema.define(version: 2020_02_04_131054) do t.index ["group_id", "token_encrypted"], name: "index_scim_oauth_access_tokens_on_group_id_and_token_encrypted", unique: true end + create_table "security_scans", force: :cascade do |t| + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false + t.bigint "build_id", null: false + t.integer "scan_type", limit: 2, null: false + t.index ["build_id", "scan_type"], name: "idx_security_scans_on_build_and_scan_type", unique: true + t.index ["scan_type"], name: "idx_security_scans_on_scan_type" + end + create_table "self_managed_prometheus_alert_events", force: :cascade do |t| t.bigint "project_id", null: false t.bigint "environment_id" @@ -4863,6 +4872,7 @@ ActiveRecord::Schema.define(version: 2020_02_04_131054) do add_foreign_key "reviews", "users", column: "author_id", on_delete: :nullify add_foreign_key "saml_providers", "namespaces", column: "group_id", on_delete: :cascade add_foreign_key "scim_oauth_access_tokens", "namespaces", column: "group_id", on_delete: :cascade + add_foreign_key "security_scans", "ci_builds", column: "build_id", on_delete: :cascade add_foreign_key "self_managed_prometheus_alert_events", "environments", on_delete: :cascade add_foreign_key "self_managed_prometheus_alert_events", "projects", on_delete: :cascade add_foreign_key "sentry_issues", "issues", on_delete: :cascade -- cgit v1.2.3