Reputation: 632
In the down() function of my migration i have the following line:
$table->integer('placeholder')->change();
Here I try to change the column type 'number'
from string(750 characters) to integer. Whenever I try to run this rollback, I get hit with:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax
This also happens when I try to change the column to something else (such as a boolean). Setting the amount of characters from 750 to 191, so: $table->string('placeholder',191)->change();
does work.
The table I'm working in currently does not contain any data & i'm using the utf8mb4 character-set
Upvotes: 0
Views: 408
Reputation: 390
Perhaps in the current table you have filled in the column 'placeholder' that does not correspond to the new rules of this column.
Upvotes: 1
Reputation: 1312
Are you sure your column name is number
? It is a keyword in mysql
and such column names cannot be used unless you quote it like `number`
. It is not a good practice to use such keywords as a column name.
Upvotes: 2