main
This commit is contained in:
+73
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateWalletMoudleTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('wallets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$ownerTypes = [
|
||||
1 => "user",
|
||||
2 => "shop",
|
||||
];
|
||||
$table->enum('owner_type', array_keys($ownerTypes))->default(1);
|
||||
$table->timestamps();
|
||||
$table->bigInteger('owner');
|
||||
$table->bigInteger('cash');
|
||||
$table->string('hash', 128)->nullable(true);
|
||||
$table->float('gold');
|
||||
$table->bigInteger('fund_id')->nullable();
|
||||
|
||||
});
|
||||
|
||||
Schema::create('transactions', function (Blueprint $table) {
|
||||
$transactionTypes = [
|
||||
1 => "cash",
|
||||
2 => "gold",
|
||||
3 => "expire",
|
||||
];
|
||||
$table->id();
|
||||
$table->bigInteger('wallet', false, true);
|
||||
$table->enum('transaction_type', array_keys($transactionTypes))->default(1);
|
||||
$table->timestamps();
|
||||
$table->bigInteger('cash')->nullable();
|
||||
$table->float('gold')->default(0);
|
||||
$table->dateTime('expire_at')->nullable(true);
|
||||
$table->string('hash', 128)->nullable(true);
|
||||
$table->text('note')->nullable(true);
|
||||
$table->bigInteger('customer_id')->nullable()->unsigned();
|
||||
$table->integer('type')->nullable()->unsigned();
|
||||
$table->bigInteger('fund_id')->nullable();
|
||||
$table->timestamp('start_at')->nullable();
|
||||
$table->timestamp('end_at')->nullable();
|
||||
|
||||
});
|
||||
|
||||
Schema::create('transaction_metas', function (Blueprint $table) {
|
||||
$table->bigInteger('transaction', false, true);
|
||||
$table->bigInteger('order_id')->nullable()->unsigned();
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user