43 lines
1.5 KiB
PHP
43 lines
1.5 KiB
PHP
<?php
|
||
|
||
use Illuminate\Database\Migrations\Migration;
|
||
use Illuminate\Database\Schema\Blueprint;
|
||
use Illuminate\Support\Facades\Schema;
|
||
|
||
class CreateCouponsTable extends Migration
|
||
{
|
||
/**
|
||
* Run the migrations.
|
||
*
|
||
* @return void
|
||
*/
|
||
public function up()
|
||
{
|
||
Schema::create('coupons', function (Blueprint $table) {
|
||
$table->id();
|
||
$table->string('name')->comment('优惠券名称');
|
||
$table->text('description')->nullable()->comment('优惠券说明');
|
||
$table->tinyInteger('type')->default(0)->unsigned()->comment('优惠券类型:1抵扣券,2折扣券');
|
||
$table->unsignedBigInteger('amount')->default(0)->comment('抵扣金额:分/折扣(100)');
|
||
$table->unsignedBigInteger('threshold')->default(0)->comment('使用门槛金额:分');
|
||
$table->unsignedInteger('limit')->default(0)->comment('限量');
|
||
$table->unsignedInteger('sent')->default(0)->comment('已送数量');
|
||
$table->unsignedInteger('stock')->default(0)->comment('剩余量');
|
||
$table->unsignedInteger('use_day')->default(0)->comment('使用期限');
|
||
$table->timestamp('use_start_at')->nullable()->comment('使用开始时间');
|
||
$table->timestamp('use_end_at')->nullable()->comment('使用结束时间');
|
||
$table->timestamps();
|
||
});
|
||
}
|
||
|
||
/**
|
||
* Reverse the migrations.
|
||
*
|
||
* @return void
|
||
*/
|
||
public function down()
|
||
{
|
||
Schema::dropIfExists('coupons');
|
||
}
|
||
}
|