36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration {
|
|
public function up(): void
|
|
{
|
|
if (Schema::hasTable('subscriptions')) {
|
|
return;
|
|
}
|
|
Schema::create('subscriptions', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('tenant_id');
|
|
$table->string('customer', 100);
|
|
$table->string('plan', 50)->default('Business');
|
|
$table->bigInteger('monthly_fee')->default(0);
|
|
$table->string('billing_cycle', 20)->default('monthly');
|
|
$table->date('start_date')->nullable();
|
|
$table->date('next_billing')->nullable();
|
|
$table->string('status', 20)->default('active');
|
|
$table->integer('users')->default(0);
|
|
$table->text('memo')->nullable();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
$table->index(['tenant_id', 'status']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('subscriptions');
|
|
}
|
|
};
|