Bill transfer storage monthly with a 15-day grace period before deletion.
Deploy Ladill Transfer / deploy (push) Successful in 51s
Deploy Ladill Transfer / deploy (push) Successful in 51s
Files stay available while wallet renewals succeed each month. Failed renewals keep files for TRANSFER_GRACE_PERIOD_DAYS (default 15) before automatic cleanup. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('transfers', function (Blueprint $table) {
|
||||
$table->timestamp('paid_until')->nullable()->after('expires_at');
|
||||
$table->timestamp('grace_ends_at')->nullable()->after('paid_until');
|
||||
$table->timestamp('last_billed_at')->nullable()->after('grace_ends_at');
|
||||
|
||||
$table->index(['status', 'paid_until']);
|
||||
$table->index(['status', 'grace_ends_at']);
|
||||
});
|
||||
|
||||
DB::table('transfers')
|
||||
->whereNull('paid_until')
|
||||
->whereNotNull('expires_at')
|
||||
->update(['paid_until' => DB::raw('expires_at')]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('transfers', function (Blueprint $table) {
|
||||
$table->dropIndex(['status', 'paid_until']);
|
||||
$table->dropIndex(['status', 'grace_ends_at']);
|
||||
$table->dropColumn(['paid_until', 'grace_ends_at', 'last_billed_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user