【发布时间】:2020-06-16 22:30:25
【问题描述】:
我正在尝试更改我的专栏的数据类型之一。我创建表的迁移是:
public function up()
{
Schema::create('place_ratings', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('places_id');
$table->foreign('places_id')->references('id')->on('places');
$table->integer('rating');
$table->mediumText('comments');
$table->timestamps();
});
}
我想将评级表的数据类型从integer 更改为float。我的表中已经有一些数据,我不想丢失它们。那么,我该怎么做呢?
【问题讨论】:
-
最简单的解决方案是导出数据并在本地数据库中检查。
标签: php mysql laravel alter-table laravel-migrations