Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20200622104923_create_ci_pipeline_messages_table.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 40d63b1189e161dfce293c99f267509b8202fe55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

class CreateCiPipelineMessagesTable < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  ERROR_SEVERITY = 0
  MAX_CONTENT_LENGTH = 10_000

  disable_ddl_transaction!

  def up
    with_lock_retries do
      create_table :ci_pipeline_messages do |t|
        t.integer :severity, null: false, default: ERROR_SEVERITY, limit: 2
        t.references :pipeline, index: true, null: false, foreign_key: { to_table: :ci_pipelines, on_delete: :cascade }, type: :integer
        t.text :content, null: false
      end
    end

    add_text_limit :ci_pipeline_messages, :content, MAX_CONTENT_LENGTH
  end

  def down
    drop_table :ci_pipeline_messages
  end
end