41 lines
1.0 KiB
PHP
Executable File
41 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateSubscriptionsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('subscriptions', function (Blueprint $table) {
|
|
$table->bigIncrements('id');
|
|
$table->integer('package_id');
|
|
$table->unsignedBigInteger('user_id');
|
|
$table->decimal('price', 15, 2);
|
|
//$table->integer('price');
|
|
$table->datetime('ends_at')->index();
|
|
$table->string('status')->default('pending');
|
|
$table->string('method')->default('balance');
|
|
$table->timestamps();
|
|
|
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('subscriptions');
|
|
}
|
|
}
|