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

53 lines
1.9 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateVipsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('vips', function (Blueprint $table) {
$table->id();
$table->string('name')->comment('名称');
$table->text('times')->comment('时效{num,unit,text}');
$table->decimal('price', 12, 2)->default(0)->comment('价格');
$table->unsignedInteger('sort')->default(1)->comment('排序(asc)');
$table->tinyInteger('status')->default(1)->comment('状态');
$table->text('gift')->nullable()->comment('赠品');
$table->text('description')->nullable()->comment('描述');
$table->timestamps();
});
Schema::create('user_vips', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->comment('用户ID');
$table->unsignedBigInteger('vip_id')->comment('会员ID');
$table->string('name')->comment('名称');
$table->decimal('price', 12, 2)->default(0)->comment('价格');
$table->text('times')->comment('时效{num,unit,text}');
$table->text('gift')->nullable()->comment('赠品');
$table->tinyInteger('status')->default(0)->comment('状态(0: 待支付, 1: 支付成功)');
$table->timestamp('success_time')->nullable()->comment('购买时间');
$table->timestamp('expired')->nullable()->comment('购买后的会员有效期');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('vips');
Schema::dropIfExists('user_vips');
}
}