6
0
Fork 0
jiqu-library-server/database/migrations/2021_12_07_102419_create_co...

43 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?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');
}
}