summaryrefslogtreecommitdiff
path: root/db/migrate/20220425120604_create_packages_cleanup_policies.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20220425120604_create_packages_cleanup_policies.rb')
-rw-r--r--db/migrate/20220425120604_create_packages_cleanup_policies.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/db/migrate/20220425120604_create_packages_cleanup_policies.rb b/db/migrate/20220425120604_create_packages_cleanup_policies.rb
new file mode 100644
index 00000000000..0b04457235e
--- /dev/null
+++ b/db/migrate/20220425120604_create_packages_cleanup_policies.rb
@@ -0,0 +1,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