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'); + }); + } + }, +];