More code cleanup

This commit is contained in:
James Cole
2023-12-20 19:41:37 +01:00
parent 680012056b
commit 4961b1f715
56 changed files with 111 additions and 240 deletions

View File

@@ -24,7 +24,7 @@ $current = __DIR__;
$paths = [ $paths = [
$current . '/../../app', $current . '/../../app',
$current . '/../../config', $current . '/../../config',
// $current . '/../../database', $current . '/../../database',
// $current . '/../../routes', // $current . '/../../routes',
// $current . '/../../tests', // $current . '/../../tests',
// $current . '/../../resources/lang', // $current . '/../../resources/lang',

View File

@@ -54,6 +54,7 @@ class CreateSupportTables extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void
@@ -70,9 +71,6 @@ class CreateSupportTables extends Migration
$this->createConfigurationTable(); $this->createConfigurationTable();
} }
/**
* @return void
*/
private function createAccountTypeTable(): void private function createAccountTypeTable(): void
{ {
if (!Schema::hasTable('account_types')) { if (!Schema::hasTable('account_types')) {
@@ -95,9 +93,6 @@ class CreateSupportTables extends Migration
} }
} }
/**
* @return void
*/
private function createCurrencyTable(): void private function createCurrencyTable(): void
{ {
if (!Schema::hasTable('transaction_currencies')) { if (!Schema::hasTable('transaction_currencies')) {
@@ -123,9 +118,6 @@ class CreateSupportTables extends Migration
} }
} }
/**
* @return void
*/
private function createTransactionTypeTable(): void private function createTransactionTypeTable(): void
{ {
if (!Schema::hasTable('transaction_types')) { if (!Schema::hasTable('transaction_types')) {
@@ -149,9 +141,6 @@ class CreateSupportTables extends Migration
} }
} }
/**
* @return void
*/
private function createJobsTable(): void private function createJobsTable(): void
{ {
if (!Schema::hasTable('jobs')) { if (!Schema::hasTable('jobs')) {
@@ -178,9 +167,6 @@ class CreateSupportTables extends Migration
} }
} }
/**
* @return void
*/
private function createPasswordTable(): void private function createPasswordTable(): void
{ {
if (!Schema::hasTable('password_resets')) { if (!Schema::hasTable('password_resets')) {
@@ -201,9 +187,6 @@ class CreateSupportTables extends Migration
} }
} }
/**
* @return void
*/
private function createPermissionsTable(): void private function createPermissionsTable(): void
{ {
if (!Schema::hasTable('permissions')) { if (!Schema::hasTable('permissions')) {
@@ -225,9 +208,6 @@ class CreateSupportTables extends Migration
} }
} }
/**
* @return void
*/
private function createRolesTable(): void private function createRolesTable(): void
{ {
if (!Schema::hasTable('roles')) { if (!Schema::hasTable('roles')) {
@@ -249,9 +229,6 @@ class CreateSupportTables extends Migration
} }
} }
/**
* @return void
*/
private function createPermissionRoleTable(): void private function createPermissionRoleTable(): void
{ {
if (!Schema::hasTable('permission_role')) { if (!Schema::hasTable('permission_role')) {
@@ -275,9 +252,6 @@ class CreateSupportTables extends Migration
} }
} }
/**
* @return void
*/
private function createSessionsTable(): void private function createSessionsTable(): void
{ {
if (!Schema::hasTable('sessions')) { if (!Schema::hasTable('sessions')) {
@@ -300,9 +274,6 @@ class CreateSupportTables extends Migration
} }
} }
/**
* @return void
*/
private function createConfigurationTable(): void private function createConfigurationTable(): void
{ {
if (!Schema::hasTable('configuration')) { if (!Schema::hasTable('configuration')) {

View File

@@ -45,8 +45,8 @@ class CreateUsersTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
* *
* @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -72,8 +72,8 @@ class CreateMainTables extends Migration
/** /**
* Run the migrations. * Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
* *
* @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void
{ {
@@ -252,8 +252,6 @@ class CreateMainTables extends Migration
} }
} }
/**
*/
private function createBudgetTables(): void private function createBudgetTables(): void
{ {
if (!Schema::hasTable('budgets')) { if (!Schema::hasTable('budgets')) {
@@ -317,9 +315,6 @@ class CreateMainTables extends Migration
} }
} }
/**
* @return void
*/
private function createCategoriesTable(): void private function createCategoriesTable(): void
{ {
if (!Schema::hasTable('categories')) { if (!Schema::hasTable('categories')) {
@@ -368,9 +363,6 @@ class CreateMainTables extends Migration
} }
} }
/**
* @return void
*/
private function createRoleTable(): void private function createRoleTable(): void
{ {
if (!Schema::hasTable('role_user')) { if (!Schema::hasTable('role_user')) {
@@ -499,9 +491,6 @@ class CreateMainTables extends Migration
} }
} }
/**
* @return void
*/
private function createTagsTable(): void private function createTagsTable(): void
{ {
if (!Schema::hasTable('tags')) { if (!Schema::hasTable('tags')) {
@@ -533,9 +522,6 @@ class CreateMainTables extends Migration
} }
} }
/**
* @return void
*/
private function createTransactionTables(): void private function createTransactionTables(): void
{ {
if (!Schema::hasTable('transaction_journals')) { if (!Schema::hasTable('transaction_journals')) {

View File

@@ -37,8 +37,8 @@ class ChangesFor3101 extends Migration
/** /**
* Run the migrations. * Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
* *
* @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void {} public function up(): void {}
} }

View File

@@ -42,8 +42,8 @@ class FixNullables extends Migration
/** /**
* Run the migrations. * Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
* *
* @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -46,7 +46,7 @@ class ExpandTransactionsTable extends Migration
$table->dropColumn('identifier'); $table->dropColumn('identifier');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not drop column "identifier": %s', $e->getMessage())); app('log')->error(sprintf('Could not drop column "identifier": %s', $e->getMessage()));
app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.'); app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -55,8 +55,8 @@ class ExpandTransactionsTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
* *
* @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -42,6 +42,7 @@ class ChangesForV410 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -54,8 +54,8 @@ class ChangesForV420 extends Migration
/** /**
* Run the migrations. * Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
* *
* @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -42,6 +42,7 @@ class ChangesForV430 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -74,7 +74,7 @@ class ChangesForV431 extends Migration
$table->renameColumn('start_date', 'startdate'); $table->renameColumn('start_date', 'startdate');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -89,7 +89,7 @@ class ChangesForV431 extends Migration
$table->dropColumn('end_date'); $table->dropColumn('end_date');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -103,7 +103,7 @@ class ChangesForV431 extends Migration
$table->dropColumn('decimal_places'); $table->dropColumn('decimal_places');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -112,6 +112,7 @@ class ChangesForV431 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void
@@ -140,7 +141,7 @@ class ChangesForV431 extends Migration
$table->renameColumn('startdate', 'start_date'); $table->renameColumn('startdate', 'start_date');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -170,7 +171,7 @@ class ChangesForV431 extends Migration
$table->dropColumn('repeats'); $table->dropColumn('repeats');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -183,7 +184,7 @@ class ChangesForV431 extends Migration
$table->dropColumn('repeat_freq'); $table->dropColumn('repeat_freq');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }

View File

@@ -39,6 +39,7 @@ class ChangesForV440 extends Migration
public function down(): void public function down(): void
{ {
Schema::dropIfExists('currency_exchange_rates'); Schema::dropIfExists('currency_exchange_rates');
try { try {
Schema::table( Schema::table(
'transactions', 'transactions',
@@ -52,7 +53,7 @@ class ChangesForV440 extends Migration
} }
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -60,6 +61,7 @@ class ChangesForV440 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -47,7 +47,7 @@ class ChangesForV450 extends Migration
$table->dropColumn('foreign_amount'); $table->dropColumn('foreign_amount');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -75,7 +75,7 @@ class ChangesForV450 extends Migration
$table->dropColumn('foreign_currency_id'); $table->dropColumn('foreign_currency_id');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -84,6 +84,7 @@ class ChangesForV450 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -44,6 +44,7 @@ class ChangesForV470 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -47,7 +47,7 @@ class ChangesForV470a extends Migration
$table->dropColumn('reconciled'); $table->dropColumn('reconciled');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -56,6 +56,7 @@ class ChangesForV470a extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -44,6 +44,7 @@ class CreateOauthAuthCodesTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -44,6 +44,7 @@ class CreateOauthAccessTokensTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -44,6 +44,7 @@ class CreateOauthRefreshTokensTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -44,6 +44,7 @@ class CreateOauthClientsTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -44,6 +44,7 @@ class CreateOauthPersonalAccessClientsTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -36,8 +36,6 @@ class ChangesForV472 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -63,7 +61,7 @@ class ChangesForV472 extends Migration
$table->dropColumn('order'); $table->dropColumn('order');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -73,7 +71,6 @@ class ChangesForV472 extends Migration
/** /**
* Run the migrations. * Run the migrations.
* *
* @return void
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void
@@ -86,7 +83,7 @@ class ChangesForV472 extends Migration
$table->dropColumn('notes'); $table->dropColumn('notes');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }

View File

@@ -37,8 +37,6 @@ class ChangesForV473 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -54,7 +52,7 @@ class ChangesForV473 extends Migration
$table->dropColumn('transaction_currency_id'); $table->dropColumn('transaction_currency_id');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -68,7 +66,7 @@ class ChangesForV473 extends Migration
$table->dropColumn('strict'); $table->dropColumn('strict');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -77,8 +75,8 @@ class ChangesForV473 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -33,15 +33,12 @@ class ChangesForV474 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void {} public function down(): void {}
/** /**
* Run the migrations. * Run the migrations.
* *
* @return void
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void {} public function up(): void {}

View File

@@ -35,8 +35,6 @@ class ChangesForV475 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -49,8 +47,8 @@ class ChangesForV475 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -36,8 +36,6 @@ class ChangesForV477 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -54,7 +52,7 @@ class ChangesForV477 extends Migration
$table->dropColumn(['transaction_currency_id']); $table->dropColumn(['transaction_currency_id']);
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -63,8 +61,8 @@ class ChangesForV477 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -36,8 +36,6 @@ class ChangesForV479 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -49,7 +47,7 @@ class ChangesForV479 extends Migration
$table->dropColumn(['enabled']); $table->dropColumn(['enabled']);
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -58,8 +56,8 @@ class ChangesForV479 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -36,8 +36,6 @@ class ChangesForV4710 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -47,8 +45,8 @@ class ChangesForV4710 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -36,22 +36,17 @@ class ChangesForV4711 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void {}
{
//
}
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {
/** /*
* In 4.7.11, I changed the date field to a "datetimetz" field. This wreaks havoc * In 4.7.11, I changed the date field to a "datetimetz" field. This wreaks havoc
* because apparently MySQL is not actually capable of handling multiple time zones, * because apparently MySQL is not actually capable of handling multiple time zones,
* only having a server wide time zone setting. Actual database schemes like Postgres * only having a server wide time zone setting. Actual database schemes like Postgres

View File

@@ -35,22 +35,17 @@ class ChangesForV4712 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void {}
{
//
}
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {
/** /*
* In 4.7.11, I changed the date field to a "datetimetz" field. This wreaks havoc * In 4.7.11, I changed the date field to a "datetimetz" field. This wreaks havoc
* because apparently MySQL is not actually capable of handling multiple time zones, * because apparently MySQL is not actually capable of handling multiple time zones,
* only having a server wide time zone setting. Actual database schemes like Postgres * only having a server wide time zone setting. Actual database schemes like Postgres

View File

@@ -36,8 +36,6 @@ class FixLdapConfiguration extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -49,7 +47,7 @@ class FixLdapConfiguration extends Migration
$table->dropColumn(['objectguid']); $table->dropColumn(['objectguid']);
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -58,12 +56,12 @@ class FixLdapConfiguration extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {
/** /*
* ADLdap2 appears to require the ability to store an objectguid for LDAP users * ADLdap2 appears to require the ability to store an objectguid for LDAP users
* now. To support this, we add the column. * now. To support this, we add the column.
*/ */

View File

@@ -35,8 +35,6 @@ class ChangesForV480 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -56,9 +54,10 @@ class ChangesForV480 extends Migration
app('log')->error('If the foreign ID does not exist (see error), this is not an problem. Otherwise, please open a GitHub discussion.'); app('log')->error('If the foreign ID does not exist (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
} }
try { try {
$table->dropColumn('transaction_group_id'); $table->dropColumn('transaction_group_id');
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not drop column: %s', $e->getMessage())); app('log')->error(sprintf('Could not drop column: %s', $e->getMessage()));
app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.'); app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -78,7 +77,7 @@ class ChangesForV480 extends Migration
static function (Blueprint $table) { static function (Blueprint $table) {
try { try {
$table->dropColumn('stop_processing'); $table->dropColumn('stop_processing');
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not drop column: %s', $e->getMessage())); app('log')->error(sprintf('Could not drop column: %s', $e->getMessage()));
app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.'); app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -98,7 +97,7 @@ class ChangesForV480 extends Migration
static function (Blueprint $table) { static function (Blueprint $table) {
try { try {
$table->dropColumn('mfa_secret'); $table->dropColumn('mfa_secret');
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not drop column: %s', $e->getMessage())); app('log')->error(sprintf('Could not drop column: %s', $e->getMessage()));
app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.'); app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -113,8 +112,8 @@ class ChangesForV480 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {
@@ -128,7 +127,8 @@ class ChangesForV480 extends Migration
// add column "group_id" after "transaction_type_id" // add column "group_id" after "transaction_type_id"
$table->integer('transaction_group_id', false, true) $table->integer('transaction_group_id', false, true)
->nullable()->default(null)->after('transaction_type_id'); ->nullable()->default(null)->after('transaction_type_id')
;
// add foreign key for "transaction_group_id" // add foreign key for "transaction_group_id"
try { try {

View File

@@ -36,8 +36,6 @@ class MakeLocationsTable extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -46,8 +44,8 @@ class MakeLocationsTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -34,8 +34,6 @@ class ChangesForV520 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -45,8 +43,8 @@ class ChangesForV520 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -35,8 +35,6 @@ class ChangesForV530 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -46,8 +44,8 @@ class ChangesForV530 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -37,8 +37,6 @@ class ChangesForV530a extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -50,7 +48,7 @@ class ChangesForV530a extends Migration
$table->dropColumn('order'); $table->dropColumn('order');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -59,8 +57,8 @@ class ChangesForV530a extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -37,8 +37,6 @@ class ChangesForV540 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -50,7 +48,7 @@ class ChangesForV540 extends Migration
$table->dropColumn('provider'); $table->dropColumn('provider');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -64,7 +62,7 @@ class ChangesForV540 extends Migration
$table->dropColumn('order'); $table->dropColumn('order');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -78,7 +76,7 @@ class ChangesForV540 extends Migration
$table->dropColumn('end_date'); $table->dropColumn('end_date');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -91,7 +89,7 @@ class ChangesForV540 extends Migration
$table->dropColumn('extension_date'); $table->dropColumn('extension_date');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -100,8 +98,8 @@ class ChangesForV540 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -35,8 +35,6 @@ class ChangesForV550 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -78,7 +76,7 @@ class ChangesForV550 extends Migration
$table->dropColumn('budget_limit_id'); $table->dropColumn('budget_limit_id');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -97,7 +95,7 @@ class ChangesForV550 extends Migration
$table->dropColumn('period'); $table->dropColumn('period');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -110,7 +108,7 @@ class ChangesForV550 extends Migration
$table->dropColumn('generated'); $table->dropColumn('generated');
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -124,8 +122,8 @@ class ChangesForV550 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -35,8 +35,6 @@ class ChangesForV550b2 extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -53,7 +51,7 @@ class ChangesForV550b2 extends Migration
} }
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -62,8 +60,8 @@ class ChangesForV550b2 extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -43,7 +43,7 @@ class AddLdapColumnsToUsersTable extends Migration
$table->dropColumn(['domain']); $table->dropColumn(['domain']);
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -52,6 +52,7 @@ class AddLdapColumnsToUsersTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void

View File

@@ -34,18 +34,13 @@ class ExtendCurrencyInfo extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void {}
{
//
}
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -32,8 +32,6 @@ class DropTeleTable extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -42,8 +40,8 @@ class DropTeleTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -53,8 +53,6 @@ class UserGroups extends Migration
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -74,7 +72,7 @@ class UserGroups extends Migration
} }
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -94,7 +92,7 @@ class UserGroups extends Migration
} }
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
@@ -107,8 +105,8 @@ class UserGroups extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {
@@ -175,6 +173,7 @@ class UserGroups extends Migration
app('log')->error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.'); app('log')->error('If this table exists already (see the error message), this is not a problem. Other errors? Please open a discussion on GitHub.');
} }
} }
try { try {
Schema::table( Schema::table(
'users', 'users',
@@ -191,6 +190,7 @@ class UserGroups extends Migration
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }
// ADD columns to tables // ADD columns to tables
/** @var string $tableName */ /** @var string $tableName */
foreach ($this->tables as $tableName) { foreach ($this->tables as $tableName) {

View File

@@ -34,8 +34,6 @@ class CreateLocalPersonalAccessTokensTable extends Migration
{ {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -44,8 +42,8 @@ class CreateLocalPersonalAccessTokensTable extends Migration
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {

View File

@@ -28,14 +28,11 @@ use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
/** return new class() extends Migration {
*
*/
return new class () extends Migration {
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {
@@ -57,8 +54,6 @@ return new class () extends Migration {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {
@@ -74,7 +69,7 @@ return new class () extends Migration {
} }
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }

View File

@@ -27,11 +27,11 @@ use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class () extends Migration { return new class() extends Migration {
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {
@@ -54,8 +54,6 @@ return new class () extends Migration {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {

View File

@@ -27,11 +27,11 @@ use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class () extends Migration { return new class() extends Migration {
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {
@@ -56,8 +56,6 @@ return new class () extends Migration {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {

View File

@@ -27,11 +27,11 @@ use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class () extends Migration { return new class() extends Migration {
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* @return void
*/ */
public function up(): void public function up(): void
{ {
@@ -61,8 +61,6 @@ return new class () extends Migration {
/** /**
* Reverse the migrations. * Reverse the migrations.
*
* @return void
*/ */
public function down(): void public function down(): void
{ {

View File

@@ -1,6 +1,5 @@
<?php <?php
/* /*
* 2023_08_11_192521_upgrade_og_table.php * 2023_08_11_192521_upgrade_og_table.php
* Copyright (c) 2023 james@firefly-iii.org * Copyright (c) 2023 james@firefly-iii.org
@@ -29,12 +28,10 @@ use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
/** return new class() extends Migration {
*
*/
return new class () extends Migration {
/** /**
* Run the migrations. * Run the migrations.
*
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
*/ */
public function up(): void public function up(): void
@@ -74,7 +71,7 @@ return new class () extends Migration {
} }
} }
); );
} catch (QueryException | ColumnDoesNotExist $e) { } catch (ColumnDoesNotExist|QueryException $e) {
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage())); 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.'); app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
} }

View File

@@ -1,6 +1,5 @@
<?php <?php
/* /*
* 2023_10_21_113213_add_currency_pivot_tables.php * 2023_10_21_113213_add_currency_pivot_tables.php
* Copyright (c) 2023 james@firefly-iii.org * Copyright (c) 2023 james@firefly-iii.org
@@ -28,7 +27,7 @@ use Illuminate\Database\QueryException;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class () extends Migration { return new class() extends Migration {
/** /**
* @SuppressWarnings(PHPMD.ShortMethodName) * @SuppressWarnings(PHPMD.ShortMethodName)
* Run the migrations. * Run the migrations.

View File

@@ -25,7 +25,6 @@ namespace Database\Seeders;
use FireflyIII\Models\AccountType; use FireflyIII\Models\AccountType;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use PDOException;
/** /**
* Class AccountTypeSeeder. * Class AccountTypeSeeder.
@@ -52,7 +51,7 @@ class AccountTypeSeeder extends Seeder
foreach ($types as $type) { foreach ($types as $type) {
try { try {
AccountType::create(['type' => $type]); AccountType::create(['type' => $type]);
} catch (PDOException $e) { } catch (\PDOException $e) {
// @ignoreException // @ignoreException
} }
} }

View File

@@ -34,14 +34,12 @@ use Illuminate\Database\Seeder;
*/ */
class ExchangeRateSeeder extends Seeder class ExchangeRateSeeder extends Seeder
{ {
/**
* @return void
*/
public function run(): void public function run(): void
{ {
$count = User::count(); $count = User::count();
if (0 === $count) { if (0 === $count) {
app('log')->debug('Will not seed exchange rates yet.'); app('log')->debug('Will not seed exchange rates yet.');
return; return;
} }
$users = User::get(); $users = User::get();
@@ -73,41 +71,22 @@ class ExchangeRateSeeder extends Seeder
} }
} }
/**
* @param string $code
*
* @return TransactionCurrency|null
*/
private function getCurrency(string $code): ?TransactionCurrency private function getCurrency(string $code): ?TransactionCurrency
{ {
return TransactionCurrency::whereNull('deleted_at')->where('code', $code)->first(); return TransactionCurrency::whereNull('deleted_at')->where('code', $code)->first();
} }
/**
* @param User $user
* @param TransactionCurrency $from
* @param TransactionCurrency $to
* @param string $date
*
* @return bool
*/
private function hasRate(User $user, TransactionCurrency $from, TransactionCurrency $to, string $date): bool private function hasRate(User $user, TransactionCurrency $from, TransactionCurrency $to, string $date): bool
{ {
return $user->currencyExchangeRates() return $user->currencyExchangeRates()
->where('from_currency_id', $from->id) ->where('from_currency_id', $from->id)
->where('to_currency_id', $to->id) ->where('to_currency_id', $to->id)
->where('date', $date) ->where('date', $date)
->count() > 0; ->count() > 0
;
} }
/** /**
* @param User $user
* @param TransactionCurrency $from
* @param TransactionCurrency $to
* @param string $date
* @param float $rate
*
* @return void
* @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/ */
private function addRate(User $user, TransactionCurrency $from, TransactionCurrency $to, string $date, float $rate): void private function addRate(User $user, TransactionCurrency $from, TransactionCurrency $to, string $date, float $rate): void

View File

@@ -25,16 +25,12 @@ namespace Database\Seeders;
use FireflyIII\Models\LinkType; use FireflyIII\Models\LinkType;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use PDOException;
/** /**
* Class LinkTypeSeeder. * Class LinkTypeSeeder.
*/ */
class LinkTypeSeeder extends Seeder class LinkTypeSeeder extends Seeder
{ {
/**
* @return void
*/
public function run(): void public function run(): void
{ {
$types = [ $types = [
@@ -66,7 +62,7 @@ class LinkTypeSeeder extends Seeder
foreach ($types as $type) { foreach ($types as $type) {
try { try {
LinkType::create($type); LinkType::create($type);
} catch (PDOException $e) { } catch (\PDOException $e) {
// @ignoreException // @ignoreException
} }
} }

View File

@@ -25,7 +25,6 @@ namespace Database\Seeders;
use FireflyIII\Models\Role; use FireflyIII\Models\Role;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use PDOException;
/** /**
* Class PermissionSeeder. * Class PermissionSeeder.
@@ -49,7 +48,7 @@ class PermissionSeeder extends Seeder
foreach ($roles as $role) { foreach ($roles as $role) {
try { try {
Role::create($role); Role::create($role);
} catch (PDOException $e) { } catch (\PDOException $e) {
// @ignoreException // @ignoreException
} }
} }

View File

@@ -25,15 +25,12 @@ namespace Database\Seeders;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use PDOException;
/** /**
* Class TransactionCurrencySeeder. * Class TransactionCurrencySeeder.
*/ */
class TransactionCurrencySeeder extends Seeder class TransactionCurrencySeeder extends Seeder
{ {
/**
*/
public function run(): void public function run(): void
{ {
$currencies = []; $currencies = [];
@@ -76,7 +73,7 @@ class TransactionCurrencySeeder extends Seeder
foreach ($currencies as $currency) { foreach ($currencies as $currency) {
try { try {
TransactionCurrency::create($currency); TransactionCurrency::create($currency);
} catch (PDOException $e) { } catch (\PDOException $e) {
// @ignoreException // @ignoreException
} }
} }

View File

@@ -25,7 +25,6 @@ namespace Database\Seeders;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use PDOException;
/** /**
* Class TransactionTypeSeeder. * Class TransactionTypeSeeder.
@@ -47,7 +46,7 @@ class TransactionTypeSeeder extends Seeder
foreach ($types as $type) { foreach ($types as $type) {
try { try {
TransactionType::create(['type' => $type]); TransactionType::create(['type' => $type]);
} catch (PDOException $e) { } catch (\PDOException $e) {
// @ignoreException // @ignoreException
} }
} }

View File

@@ -27,7 +27,6 @@ namespace Database\Seeders;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Models\UserRole; use FireflyIII\Models\UserRole;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
use PDOException;
/** /**
* Class UserRoleSeeder * Class UserRoleSeeder
@@ -36,8 +35,6 @@ class UserRoleSeeder extends Seeder
{ {
/** /**
* Run the database seeds. * Run the database seeds.
*
* @return void
*/ */
public function run() public function run()
{ {
@@ -50,7 +47,7 @@ class UserRoleSeeder extends Seeder
foreach ($roles as $role) { foreach ($roles as $role) {
try { try {
UserRole::create(['title' => $role]); UserRole::create(['title' => $role]);
} catch (PDOException $e) { } catch (\PDOException $e) {
// @ignoreException // @ignoreException
} }
} }