<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('name', 255)->comment('comment added')->change();
});
}
};
public function up() {
Schema::table('product', function (Blueprint $table) {
$table->string('product_type')
->comment('0 = A Industrial Products, 1 = A Consumer Products')
->change();
});
}
3条答案
按热度按时间bq8i3lrv1#
参见文件:https://laravel.com/docs/7.x/migrations#modifying-columns
创建移植文件
然后
将添加评论:
wfypjpf42#
首先你需要使用下面的命令安装doctrine/dbal包
然后创建迁移以进行更改
在创建的迁移文件中进行更改
然后运行
qyyhg6bp3#