37 lines
1.1 KiB
PHP
37 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('purchases')) {
|
|
return;
|
|
}
|
|
Schema::create('purchases', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('tenant_id');
|
|
$table->date('date');
|
|
$table->string('vendor', 100);
|
|
$table->string('item', 200)->nullable();
|
|
$table->string('category', 50)->default('운영비');
|
|
$table->bigInteger('amount')->default(0);
|
|
$table->bigInteger('vat')->default(0);
|
|
$table->string('status', 20)->default('pending');
|
|
$table->string('invoice_no', 50)->nullable();
|
|
$table->text('memo')->nullable();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
$table->index(['tenant_id', 'status']);
|
|
$table->index(['tenant_id', 'date']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('purchases');
|
|
}
|
|
};
|