Implement package limit notification system

This commit is contained in:
Codex Agent
2025-11-01 13:19:07 +01:00
parent 81cdee428e
commit 2c14493604
87 changed files with 4557 additions and 290 deletions

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('event_packages', function (Blueprint $table) {
if (! Schema::hasColumn('event_packages', 'gallery_warning_sent_at')) {
$table->timestamp('gallery_warning_sent_at')->nullable()->after('gallery_expires_at');
}
if (! Schema::hasColumn('event_packages', 'gallery_expired_notified_at')) {
$table->timestamp('gallery_expired_notified_at')->nullable()->after('gallery_warning_sent_at');
}
});
}
public function down(): void
{
Schema::table('event_packages', function (Blueprint $table) {
if (Schema::hasColumn('event_packages', 'gallery_warning_sent_at')) {
$table->dropColumn('gallery_warning_sent_at');
}
if (Schema::hasColumn('event_packages', 'gallery_expired_notified_at')) {
$table->dropColumn('gallery_expired_notified_at');
}
});
}
};

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('tenants', function (Blueprint $table) {
if (! Schema::hasColumn('tenants', 'notification_preferences')) {
$table->json('notification_preferences')->nullable()->after('settings');
}
if (! Schema::hasColumn('tenants', 'credit_warning_sent_at')) {
$table->timestamp('credit_warning_sent_at')->nullable()->after('notification_preferences');
}
if (! Schema::hasColumn('tenants', 'credit_warning_threshold')) {
$table->unsignedInteger('credit_warning_threshold')->nullable()->after('credit_warning_sent_at');
}
});
}
public function down(): void
{
Schema::table('tenants', function (Blueprint $table) {
foreach ([
'credit_warning_threshold',
'credit_warning_sent_at',
'notification_preferences',
] as $column) {
if (Schema::hasColumn('tenants', $column)) {
$table->dropColumn($column);
}
}
});
}
};

View File

@@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('tenant_packages', function (Blueprint $table) {
if (! Schema::hasColumn('tenant_packages', 'event_warning_sent_at')) {
$table->timestamp('event_warning_sent_at')->nullable()->after('used_events');
}
if (! Schema::hasColumn('tenant_packages', 'event_warning_threshold')) {
$table->decimal('event_warning_threshold', 5, 2)->nullable()->after('event_warning_sent_at');
}
if (! Schema::hasColumn('tenant_packages', 'event_limit_notified_at')) {
$table->timestamp('event_limit_notified_at')->nullable()->after('event_warning_threshold');
}
if (! Schema::hasColumn('tenant_packages', 'expiry_warning_sent_at')) {
$table->timestamp('expiry_warning_sent_at')->nullable()->after('event_limit_notified_at');
}
if (! Schema::hasColumn('tenant_packages', 'expired_notified_at')) {
$table->timestamp('expired_notified_at')->nullable()->after('expiry_warning_sent_at');
}
});
}
public function down(): void
{
Schema::table('tenant_packages', function (Blueprint $table) {
foreach ([
'expired_notified_at',
'expiry_warning_sent_at',
'event_limit_notified_at',
'event_warning_threshold',
'event_warning_sent_at',
] as $column) {
if (Schema::hasColumn('tenant_packages', $column)) {
$table->dropColumn($column);
}
}
});
}
};