2023_05_08_111932_create_commissions_table.php
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCommissionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_commissions', function (Blueprint $table) {
$table->increments('id');
$table->unsignedBigInteger('user_id')->index()->comment('用户ID');
$table->unsignedBigInteger('invite_user_id')->index()->comment('邀请用户ID');
$table->decimal('amount', 11)->nullable()->default(0.00)->comment('订单总额');
$table->decimal('income', 11)->nullable()->default(0.00)->comment('收益');
$table->tinyInteger('level')->nullable()->default(100)->comment('分佣等级');
$table->tinyInteger('ratio')->nullable()->default(100)->comment('分佣比例');
$table->tinyInteger('status')->nullable()->default(1)->comment('状态:1-有效;0-无效');
$table->timestamps();
$table->softDeletes();
});
DB::statement("ALTER TABLE `user_commissions` comment '用户-分佣记录' ");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_commissions');
}
}