Laravel migration with SQLite 'Cannot add a NOT NULL column with default value NULL'

前端 未结 8 739
隐瞒了意图╮
隐瞒了意图╮ 2020-12-05 23:50

Why am I getting this warning when using the SQLite driver? I have no problems with the MySQL driver but SQLite is throwing this error.

It does not make sense to me

8条回答
  •  时光说笑
    2020-12-06 00:20

    I'm not familiar with Laravel, but apparently the use of the after method to specify the order of columns appears to specifically mention ONLY MySQL (Laravel) and a discussion (GitHub) seems to point to difficulties in it's use with SQLite. It may likely be incompatible because its function: "...use the after method to specify the order of columns" design runs up against the limitation in SQLite's documentation (SQLite) for adding columns... which reads: "The new column is always appended to the end of the list of existing columns." I can't say whether assigning default values with ->default($value) can get you by or not.

提交回复
热议问题