我有下面提到的专栏:
public function up()
{
Schema::create('stnk', function(Blueprint $table)
{
$table->increments('id');
$table->string('no_reg', 50)->unique();
$table->string('no_bpkb', 50)->unique();
$table->string('nama_pemilik', 100);
$table->string('alamat');
$table->string('merk', 50);
$table->string('tipe', 50);
$table->string('jenis', 50);
$table->smallInteger('tahun_pembuatan');
$table->smallInteger('tahun_registrasi');
$table->smallInteger('isi_silinder');
$table->string('no_rangka', 50);
$table->string('no_mesin', 50);
$table->string('warna', 50);
$table->string('bahan_bakar', 50);
$table->string('warna_tnkb', 50);
$table->string('kode_lokasi', 50);
$table->date('berlaku_sampai');
$table->timestamps();
$table->index('created_at');
$table->index('updated_at');
});
}
Run Code Online (Sandbox Code Playgroud)
我把播种机做成了桌子
现在我想重命名id
为id_stnk
.
我在"作曲家"中添加了一个"教义/ dbal "并做了一个composer update
.
我做了迁移php artisan migration:make rename_column
.
然后我为rename_column添加了新方法:
Schema::table('stnk', function(Blueprint $table)
{
$table->renameColumn('id', 'id_stnk');
});
Run Code Online (Sandbox Code Playgroud)
然后我试图运行命令php artisan migrate
但是我收到的错误如下所述:
[Ulluminate\Database\QueryException] …
Run Code Online (Sandbox Code Playgroud)