Expand financial administrations views.

This commit is contained in:
James Cole
2024-04-01 14:01:52 +02:00
parent bfa1fcbaf8
commit b537a3145d
14 changed files with 405 additions and 17 deletions

View File

@@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
private const string QUERY_ERROR = 'Could not execute query (table "%s", field "%s"): %s';
private const string EXPL = 'If the index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.';
private const string EXPL = 'If the index already exists (see error), or if MySQL can\'t do it, this is not an problem. Otherwise, please open a GitHub discussion.';
/**
* Run the migrations.

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
try {
Schema::table(
'user_groups',
static function (Blueprint $table): void {
if (!Schema::hasColumn('user_groups', 'default_administration')) {
$table->boolean('default_administration')->default(false)->after('title');
}
}
);
} catch (QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};