Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Bosstone's avatar

Rollback Migration: Kill

Hi,

I have accidently made a

php artisan migrate:rollback --step=2

on the wrong application on forge (shame on me). The rollback causes with an error because of a duplicate field:

Migrating: 2020_07_30_063808_add_reject_text_to_projects_table

   Illuminate\Database\QueryException  : SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'reject_text' (SQL: alter table `projects` add `reject_text` varchar(191) null)

  at /home/forge/app.austrianweddingaward.at/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   PDOException::("SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'reject_text'")
      /home/forge/app.austrianweddingaward.at/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458

  2   PDOStatement::execute()
      /home/forge/app.austrianweddingaward.at/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458



How can I stop this rollback on forge.laravel.com?

thank you very much for your time!

Stefan

0 likes
1 reply
Nakov's avatar
Nakov
Best Answer
Level 73

there is no way to stop it unless you keep a backup from the database so you can replace it.

Or maybe just set APP_ENV=production and once you run any migration command it will ask you for confirmation, it won't do it automatically.

Please or to participate in this conversation.