我想简单地重命名我的一列,尽管它一直在说
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'sendReminderCouple48' (SQL: ALTER TABLE sendIntakes CHANGE sendReminderCouple36 sendReminderCouple48 DATETIME DE
FAULT 'NULL')
目前是 sendReminderCouple36
- DATETIME
- NULLABLE
我只想把它改名为 sendReminderCouple48
```
public function up()
{
Schema::table('sendIntakes', function (Blueprint $table) {
$table->renameColumn('sendReminderCouple36', 'sendReminderCouple48');
});
}
public function down()
{
Schema::table('sendIntakes', function (Blueprint $table) {
$table->renameColumn('sendReminderCouple48', 'sendReminderCouple36');
});
}
注意:我不想在配置文件中做任何严格的更改。
2条答案
按热度按时间f2uvfpb91#
我通过将类型更改为文本-重命名-然后返回到日期时间来修复它
cxfofazt2#
这可能与laravel框架上的问题22050有关。你正在运行mariadb作为你的数据库引擎吗?
按照线程中的建议,在执行重命名调用之前,可以尝试更改列的默认值: