Laravel migration table field's type change

后端 未结 7 1481
难免孤独
难免孤独 2020-12-08 12:45

Following is my file 2015_09_14_051851_create_orders_table.php. And I want to change $table->integer(\'category_id\'); as a string with new migratio

7条回答
  •  一生所求
    2020-12-08 13:31

    Not really an answer, but just a note about ->change():

    Only the following column types can be "changed": bigInteger, binary, boolean, date, dateTime, dateTimeTz, decimal, integer, json, longText, mediumText, smallInteger, string, text, time, unsignedBigInteger, unsignedInteger and unsignedSmallInteger.

    https://laravel.com/docs/5.8/migrations#modifying-columns

    If your column isn't one of these you will need to either drop the column or use the alter statement as mentioned in other answers.

提交回复
热议问题