Fix decimals command expanded.

This commit is contained in:
James Cole
2023-05-13 05:56:49 +02:00
parent dfad93d9ec
commit 22ee504e52
7 changed files with 196 additions and 266 deletions

View File

@@ -69,13 +69,25 @@ class ChangesForV540 extends Migration
Log::error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
}
}
if(Schema::hasColumn('bills', 'end_date') && Schema::hasColumn('bills', 'extension_date')) {
// in two steps for sqlite
if(Schema::hasColumn('bills', 'end_date')) {
try {
Schema::table(
'bills',
static function (Blueprint $table) {
$table->dropColumn('end_date');
}
);
} catch (QueryException|ColumnDoesNotExist $e) {
Log::error(sprintf('Could not execute query: %s', $e->getMessage()));
Log::error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
}
}
if(Schema::hasColumn('bills', 'extension_date')) {
try {
Schema::table(
'bills',
static function (Blueprint $table) {
$table->dropColumn('extension_date');
}
);

View File

@@ -72,7 +72,9 @@ class ChangesForV550 extends Migration
Schema::table(
'budget_transaction_journal',
function (Blueprint $table) {
$table->dropForeign('budget_id_foreign');
if ('sqlite' !== config('database.default')) {
$table->dropForeign('budget_id_foreign');
}
$table->dropColumn('budget_limit_id');
}
);
@@ -86,12 +88,25 @@ class ChangesForV550 extends Migration
Schema::dropIfExists('failed_jobs');
// drop fields from budget limits
if(Schema::hasColumn('budget_limits', 'period') && Schema::hasColumn('budget_limits', 'generated')) {
// in two steps for sqlite
if(Schema::hasColumn('budget_limits', 'period')) {
try {
Schema::table(
'budget_limits',
static function (Blueprint $table) {
$table->dropColumn('period');
}
);
} catch (QueryException|ColumnDoesNotExist $e) {
Log::error(sprintf('Could not execute query: %s', $e->getMessage()));
Log::error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
}
}
if(Schema::hasColumn('budget_limits', 'generated')) {
try {
Schema::table(
'budget_limits',
static function (Blueprint $table) {
$table->dropColumn('generated');
}
);

View File

@@ -45,7 +45,9 @@ class ChangesForV550b2 extends Migration
Schema::table(
'recurrences_transactions',
function (Blueprint $table) {
$table->dropForeign('type_foreign');
if ('sqlite' !== config('database.default')) {
$table->dropForeign('type_foreign');
}
if (Schema::hasColumn('recurrences_transactions', 'transaction_type_id')) {
$table->dropColumn('transaction_type_id');
}

View File

@@ -65,7 +65,9 @@ class UserGroups extends Migration
Schema::table(
$tableName,
function (Blueprint $table) use ($tableName) {
$table->dropForeign(sprintf('%s_to_ugi', $tableName));
if ('sqlite' !== config('database.default')) {
$table->dropForeign(sprintf('%s_to_ugi', $tableName));
}
if (Schema::hasColumn($tableName, 'user_group_id')) {
$table->dropColumn('user_group_id');
}
@@ -83,7 +85,9 @@ class UserGroups extends Migration
Schema::table(
'users',
function (Blueprint $table) {
$table->dropForeign('type_user_group_id');
if ('sqlite' !== config('database.default')) {
$table->dropForeign('type_user_group_id');
}
if (Schema::hasColumn('users', 'user_group_id')) {
$table->dropColumn('user_group_id');
}

View File

@@ -67,7 +67,9 @@ return new class () extends Migration {
Schema::table(
'currency_exchange_rates',
function (Blueprint $table) {
$table->dropForeign('cer_to_ugi');
if ('sqlite' !== config('database.default')) {
$table->dropForeign('cer_to_ugi');
}
if (Schema::hasColumn('currency_exchange_rates', 'user_group_id')) {
$table->dropColumn('user_group_id');
}