From e0cebe578d51026adce461c3668478fa2a06c5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Klabbers?= Date: Fri, 8 Nov 2024 16:58:06 +0100 Subject: [PATCH] fix: older blomstra versions cannot upgrade --- ...add_cancelled_at_to_gdpr_erasure_table.php | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/migrations/2024_11_02_000000_add_cancelled_at_to_gdpr_erasure_table.php b/migrations/2024_11_02_000000_add_cancelled_at_to_gdpr_erasure_table.php index 1b4be46..97a7d42 100644 --- a/migrations/2024_11_02_000000_add_cancelled_at_to_gdpr_erasure_table.php +++ b/migrations/2024_11_02_000000_add_cancelled_at_to_gdpr_erasure_table.php @@ -7,8 +7,22 @@ * LICENSE file that was distributed with this source code. */ -use Flarum\Database\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Schema\Builder; -return Migration::addColumns('gdpr_erasure', [ - 'cancelled_at' => ['datetime', 'nullable' => true], -]); +return [ + 'up' => function (Builder $schema) { + if (! $schema->hasColumn('gdpr_erasure', 'cancelled_at')) { + $schema->table('gdpr_erasure', function (Blueprint $table) { + $table->dateTime('cancelled_at')->nullable(); + }); + } + }, + 'down' => function (Builder $schema) { + if ($schema->hasColumn('gdpr_erasure', 'cancelled_at')) { + $schema->table('gdpr_erasure', function (Blueprint $table) { + $table->dropColumn('cancelled_at'); + }); + } + }, +];