chore: stop tracking compiled blade cache
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
<?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('cats', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('cats', 'cattery_status')) {
|
||||
$table->string('cattery_status', 30)->default('active')->after('status')->index();
|
||||
}
|
||||
if (!Schema::hasColumn('cats', 'adopted_at')) {
|
||||
$table->date('adopted_at')->nullable()->after('cattery_status');
|
||||
}
|
||||
if (!Schema::hasColumn('cats', 'adoption_notes')) {
|
||||
$table->text('adoption_notes')->nullable()->after('adopted_at');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('users', 'is_active')) {
|
||||
$table->boolean('is_active')->default(true)->after('phone')->index();
|
||||
}
|
||||
if (!Schema::hasColumn('users', 'deactivated_at')) {
|
||||
$table->timestamp('deactivated_at')->nullable()->after('is_active');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('mattings', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('mattings', 'pregnancy_confirmed_at')) {
|
||||
$table->date('pregnancy_confirmed_at')->nullable()->after('status');
|
||||
}
|
||||
if (!Schema::hasColumn('mattings', 'actual_birth_date')) {
|
||||
$table->date('actual_birth_date')->nullable()->after('pregnancy_confirmed_at');
|
||||
}
|
||||
if (!Schema::hasColumn('mattings', 'breeding_notes')) {
|
||||
$table->text('breeding_notes')->nullable()->after('actual_birth_date');
|
||||
}
|
||||
});
|
||||
|
||||
if (!Schema::hasTable('notification_dispatches')) {
|
||||
Schema::create('notification_dispatches', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('notification_key', 190)->unique();
|
||||
$table->string('type', 40)->index();
|
||||
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->string('channel', 20)->default('whatsapp');
|
||||
$table->timestamp('sent_at')->nullable();
|
||||
$table->text('message')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasTable('settings')) {
|
||||
$adminRoleId = Schema::hasTable('roles')
|
||||
? DB::table('roles')->where('slug', 'admin')->value('id')
|
||||
: null;
|
||||
|
||||
$defaults = [
|
||||
['key' => 'notif_wa_status', 'value' => 'active', 'group' => 'notification'],
|
||||
['key' => 'notif_hpl_wa', 'value' => 'active', 'group' => 'notification'],
|
||||
['key' => 'notif_inventory_expiry_wa', 'value' => 'active', 'group' => 'notification'],
|
||||
['key' => 'notif_weight_stale_wa', 'value' => 'active', 'group' => 'notification'],
|
||||
['key' => 'notif_hpl_role_id', 'value' => $adminRoleId, 'group' => 'notification'],
|
||||
['key' => 'notif_inventory_role_id', 'value' => $adminRoleId, 'group' => 'notification'],
|
||||
['key' => 'notif_weight_role_id', 'value' => $adminRoleId, 'group' => 'notification'],
|
||||
];
|
||||
|
||||
foreach ($defaults as $item) {
|
||||
DB::table('settings')->updateOrInsert(
|
||||
['key' => $item['key']],
|
||||
[
|
||||
'value' => $item['value'],
|
||||
'group' => $item['group'],
|
||||
'updated_at' => now(),
|
||||
'created_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notification_dispatches');
|
||||
|
||||
Schema::table('mattings', function (Blueprint $table) {
|
||||
foreach (['pregnancy_confirmed_at', 'actual_birth_date', 'breeding_notes'] as $column) {
|
||||
if (Schema::hasColumn('mattings', $column)) {
|
||||
$table->dropColumn($column);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
foreach (['is_active', 'deactivated_at'] as $column) {
|
||||
if (Schema::hasColumn('users', $column)) {
|
||||
$table->dropColumn($column);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('cats', function (Blueprint $table) {
|
||||
foreach (['cattery_status', 'adopted_at', 'adoption_notes'] as $column) {
|
||||
if (Schema::hasColumn('cats', $column)) {
|
||||
$table->dropColumn($column);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user