From 04bcf016199d86330c6f5f050668dcf3cce46c12 Mon Sep 17 00:00:00 2001 From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Date: Mon, 13 Jan 2025 16:35:58 +0100 Subject: [PATCH] feat: DB migration for Backup retention - rename number_of_backups_locally to database_backup_retention_amount_locally - add backup retention days to local stored backups - add s3 retention fields --- ...ds_to_scheduled_database_backups_table.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 database/migrations/2025_01_13_130238_add_backup_retention_fields_to_scheduled_database_backups_table.php diff --git a/database/migrations/2025_01_13_130238_add_backup_retention_fields_to_scheduled_database_backups_table.php b/database/migrations/2025_01_13_130238_add_backup_retention_fields_to_scheduled_database_backups_table.php new file mode 100644 index 000000000..f5371ee7a --- /dev/null +++ b/database/migrations/2025_01_13_130238_add_backup_retention_fields_to_scheduled_database_backups_table.php @@ -0,0 +1,34 @@ +renameColumn('number_of_backups_locally', 'database_backup_retention_amount_locally'); + $table->integer('database_backup_retention_amount_locally')->default(0)->nullable(false)->change(); + $table->integer('database_backup_retention_days_locally')->default(0)->nullable(false); + + $table->integer('database_backup_retention_amount_s3')->default(0)->nullable(false); + $table->integer('database_backup_retention_days_s3')->default(0)->nullable(false); + $table->integer('database_backup_retention_max_storage_s3')->default(0)->nullable(false); + }); + } + + public function down() + { + Schema::table('scheduled_database_backups', function (Blueprint $table) { + $table->renameColumn('database_backup_retention_amount_locally', 'number_of_backups_locally')->nullable(true)->change(); + $table->dropColumn([ + 'database_backup_retention_days_locally', + 'database_backup_retention_amount_s3', + 'database_backup_retention_days_s3', + 'database_backup_retention_max_storage_s3', + ]); + }); + } +};