diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190121144851_add_build_annotations.rb | 35 | ||||
-rw-r--r-- | db/schema.rb | 11 |
2 files changed, 46 insertions, 0 deletions
diff --git a/db/migrate/20190121144851_add_build_annotations.rb b/db/migrate/20190121144851_add_build_annotations.rb new file mode 100644 index 00000000000..5541069af0b --- /dev/null +++ b/db/migrate/20190121144851_add_build_annotations.rb @@ -0,0 +1,35 @@ +# 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 AddBuildAnnotations < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def change + create_table(:ci_build_annotations, id: :bigserial) do |t| + t.integer :build_id, null: false, index: true + t.integer :severity, limit: 2, null: false + + # We use a smallint for line numbers as a maximum value of 32 767 should + # be more than sufficient. + t.integer :line_number, limit: 2 + + # The path to the file the check belongs to, if any. + t.text :file_path + + # We may end up displaying multiple summaries on a page. If these do not + # have any limitations on the length, this may result in very big pages. + # To prevent this from happening we enforce a more than reasonable limit + # of 512 characters. + t.string :summary, limit: 512, null: false + + t.text :description + + t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 4b6e4992056..432d8c791d8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -274,6 +274,16 @@ ActiveRecord::Schema.define(version: 20190131122559) do t.index ["namespace_id"], name: "index_chat_teams_on_namespace_id", unique: true, using: :btree end + create_table "ci_build_annotations", id: :bigserial, force: :cascade do |t| + t.integer "build_id", null: false + t.integer "severity", limit: 2, null: false + t.integer "line_number", limit: 2 + t.text "file_path" + t.string "summary", limit: 512, null: false + t.text "description" + t.index ["build_id"], name: "index_ci_build_annotations_on_build_id", using: :btree + end + create_table "ci_build_trace_chunks", id: :bigserial, force: :cascade do |t| t.integer "build_id", null: false t.integer "chunk_index", null: false @@ -2321,6 +2331,7 @@ ActiveRecord::Schema.define(version: 20190131122559) do add_foreign_key "boards", "namespaces", column: "group_id", on_delete: :cascade add_foreign_key "boards", "projects", name: "fk_f15266b5f9", on_delete: :cascade add_foreign_key "chat_teams", "namespaces", on_delete: :cascade + add_foreign_key "ci_build_annotations", "ci_builds", column: "build_id", on_delete: :cascade add_foreign_key "ci_build_trace_chunks", "ci_builds", column: "build_id", on_delete: :cascade add_foreign_key "ci_build_trace_section_names", "projects", on_delete: :cascade add_foreign_key "ci_build_trace_sections", "ci_build_trace_section_names", column: "section_name_id", name: "fk_264e112c66", on_delete: :cascade |