I
I
igordata12020-05-28 16:18:50
Laravel
igordata1, 2020-05-28 16:18:50

How to get rid of this error?

php artisan migrate:refresh
Rolling back: 2020_05_28_081938_create_createusers_table

Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'age'; check that column/key exists (SQL: alter table `users` drop `age`)

at /var/www/bossphp.x/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[42000]: Syntax error or access violation: 1091 Can't DROP 'age'; check that column/key exists")
/var/www/bossphp.x/vendor/laravel/ framework/src/Illuminate/Database/Connection.php:458

2 PDOStatement::execute()
/var/www/bossphp.x/vendor/laravel/framework/src/Illuminate/Database/Connection.php:458

Please use the argument -v to see more details.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2020-05-28
@igordata1

Very easy:

check that column/key exists

You are trying to delete a column in down that does not exist. You can write dropIfExists or remove it altogether.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question