diff options
Diffstat (limited to 'db/migrate/20210813111909_create_ci_build_trace_metadata.rb')
-rw-r--r-- | db/migrate/20210813111909_create_ci_build_trace_metadata.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/db/migrate/20210813111909_create_ci_build_trace_metadata.rb b/db/migrate/20210813111909_create_ci_build_trace_metadata.rb new file mode 100644 index 00000000000..d8b7fd656e0 --- /dev/null +++ b/db/migrate/20210813111909_create_ci_build_trace_metadata.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +class CreateCiBuildTraceMetadata < ActiveRecord::Migration[6.1] + include Gitlab::Database::MigrationHelpers + + def up + with_lock_retries do + create_table :ci_build_trace_metadata, id: false, if_not_exists: true do |t| + t.references :build, + index: false, + primary_key: true, + default: nil, + foreign_key: { to_table: :ci_builds, on_delete: :cascade }, + type: :bigint, + null: false + + t.bigint :trace_artifact_id + t.integer :archival_attempts, default: 0, null: false, limit: 2 + t.binary :checksum + t.binary :remote_checksum + + t.index :trace_artifact_id + end + end + end + + def down + with_lock_retries do + drop_table :ci_build_trace_metadata, if_exists: true + end + end +end |