update rm deadcode
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
<?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('services', function (Blueprint $table) {
|
||||
$table->longText('requirements')->nullable()->after('note');
|
||||
$table->longText('feedback')->nullable()->after('requirements');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('services', function (Blueprint $table) {
|
||||
$table->dropColumn(['requirements', 'feedback']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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('refresh_tokens', function (Blueprint $table) {
|
||||
$table->timestamp('revoked_at')->nullable()->after('expires_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('refresh_tokens', function (Blueprint $table) {
|
||||
$table->dropColumn('revoked_at');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('reinstall_logs')
|
||||
->whereNotNull('plain_password')
|
||||
->where('plain_password', '!=', '')
|
||||
->orderBy('id')
|
||||
->chunkById(200, function ($rows) {
|
||||
foreach ($rows as $row) {
|
||||
try {
|
||||
Crypt::decryptString($row->plain_password);
|
||||
continue;
|
||||
} catch (\Throwable) {
|
||||
// not yet encrypted — fall through and encrypt it
|
||||
}
|
||||
|
||||
DB::table('reinstall_logs')
|
||||
->where('id', $row->id)
|
||||
->update(['plain_password' => Crypt::encryptString($row->plain_password)]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('reinstall_logs')
|
||||
->whereNotNull('plain_password')
|
||||
->where('plain_password', '!=', '')
|
||||
->orderBy('id')
|
||||
->chunkById(200, function ($rows) {
|
||||
foreach ($rows as $row) {
|
||||
try {
|
||||
$plain = Crypt::decryptString($row->plain_password);
|
||||
} catch (\Throwable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DB::table('reinstall_logs')
|
||||
->where('id', $row->id)
|
||||
->update(['plain_password' => $plain]);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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('invoices', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('service_id')->nullable()->after('order_id')->index()
|
||||
->comment('Service this invoice upgrades; set for invoice_type=3 (upgrade)');
|
||||
|
||||
$table->foreign('service_id')->references('id')->on('services')->onDelete('set null');
|
||||
});
|
||||
|
||||
Schema::table('invoice_items', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('addon_id')->nullable()->after('product_id')->index()
|
||||
->comment('Addon purchased on this line; set for type=upgrade');
|
||||
|
||||
$table->foreign('addon_id')->references('id')->on('product_addon')->onDelete('set null');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('invoice_items', function (Blueprint $table) {
|
||||
$table->dropForeign(['addon_id']);
|
||||
$table->dropColumn('addon_id');
|
||||
});
|
||||
|
||||
Schema::table('invoices', function (Blueprint $table) {
|
||||
$table->dropForeign(['service_id']);
|
||||
$table->dropColumn('service_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
private const NEW_PERMISSIONS = [
|
||||
'media.view',
|
||||
'media.create',
|
||||
'media.destroy',
|
||||
'dashboard.view',
|
||||
'queue.manager',
|
||||
];
|
||||
|
||||
private const GRANTED_TO_ADMINISTRATOR = [
|
||||
'post.view',
|
||||
'post.create',
|
||||
'post.edit',
|
||||
'post.destroy',
|
||||
'post.manager',
|
||||
'media.view',
|
||||
'media.create',
|
||||
'media.destroy',
|
||||
'dashboard.view',
|
||||
'queue.manager',
|
||||
];
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
|
||||
foreach (self::NEW_PERMISSIONS as $name) {
|
||||
Permission::firstOrCreate(['name' => $name, 'guard_name' => 'admin']);
|
||||
}
|
||||
|
||||
$fullAdmin = Role::where('name', 'Full Administrator')->where('guard_name', 'admin')->first();
|
||||
if ($fullAdmin) {
|
||||
$fullAdmin->givePermissionTo(self::NEW_PERMISSIONS);
|
||||
}
|
||||
|
||||
$administrator = Role::where('name', 'Administrator')->where('guard_name', 'admin')->first();
|
||||
if ($administrator) {
|
||||
$administrator->givePermissionTo(self::GRANTED_TO_ADMINISTRATOR);
|
||||
}
|
||||
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Permission::where('guard_name', 'admin')
|
||||
->whereIn('name', self::NEW_PERMISSIONS)
|
||||
->delete();
|
||||
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user