erp/database/migrations/2022_07_26_090143_create_goods_table.php

42 lines
1.1 KiB
PHP
Raw Normal View History

<?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()
{
2023-04-17 18:56:59 +08:00
if (Schema::hasTable('goods')) {
return;
}
2022-08-09 16:56:52 +08:00
Schema::defaultStringLength(191);
Schema::create('goods', function (Blueprint $table) {
$table->bigIncrements('id');
2022-08-18 11:22:27 +08:00
$table->string('title');
$table->string('img_url')->nullable()->comment('商品图片');
2022-08-18 11:22:27 +08:00
$table->unsignedBigInteger('type_id')->comment('商品种类id');
$table->unsignedBigInteger('brand_id')->nullable()->comment('商品品牌id');
2022-08-18 11:22:27 +08:00
$table->string('goods_code', 32)->unique()->comment('商品编码');
$table->timestamps();
// 索引
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('goods');
}
}