summaryrefslogtreecommitdiff
path: root/db/migrate/20220828131848_create_packages_rpm_metadata.rb
blob: bfaa441fc78a70f576080305f9f52d5e236c4c4e (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
28
29
30
# frozen_string_literal: true

class CreatePackagesRpmMetadata < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!

  def up
    with_lock_retries do
      create_table :packages_rpm_metadata, id: false do |t|
        t.references :package,
                     primary_key: true,
                     default: nil,
                     index: true,
                     foreign_key: { to_table: :packages_packages, on_delete: :cascade },
                     type: :bigint
        t.text :release, default: '1', null: false, limit: 128
        t.text :summary, default: '', null: false, limit: 1000
        t.text :description, default: '', null: false, limit: 5000
        t.text :arch, default: '', null: false, limit: 255
        t.text :license, null: true, limit: 1000
        t.text :url, null: true, limit: 1000
      end
    end
  end

  def down
    with_lock_retries do
      drop_table :packages_rpm_metadata
    end
  end
end