summaryrefslogtreecommitdiff
path: root/db/migrate/20220425120604_create_packages_cleanup_policies.rb
blob: 0b04457235e5349ffed90440e33a04f8f26c0233 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

class CreatePackagesCleanupPolicies < Gitlab::Database::Migration[2.0]
  enable_lock_retries!

  def up
    create_table :packages_cleanup_policies, id: false do |t|
      t.timestamps_with_timezone null: false
      t.references :project,
                   primary_key: true,
                   default: nil,
                   index: false,
                   foreign_key: { to_table: :projects, on_delete: :cascade }
      t.datetime_with_timezone :next_run_at, null: true
      t.text :keep_n_duplicated_package_files, default: 'all', null: false, limit: 255
    end
  end

  def down
    drop_table :packages_cleanup_policies
  end
end