mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateGoodsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('goods', function (Blueprint $table) {
|
|
$table->bigIncrements('id');
|
|
$table->string('title')->nullable(false);
|
|
$table->string('img_url')->nullable(false)->comment('商品图片');
|
|
$table->unsignedBigInteger('type_id')->nullable(false)->comment('商品种类id');
|
|
$table->unsignedBigInteger('brand_id')->nullable()->comment('商品品牌id');
|
|
$table->string('goods_code', 32)->nullable(false)->comment('商品编码');
|
|
$table->timestamps();
|
|
// 索引
|
|
$table->unique('goods_code');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('goods');
|
|
}
|
|
}
|