Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?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
|
||||
{
|
||||
Schema::create('customers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id');
|
||||
$table->string('name', 100);
|
||||
$table->string('biz_no', 20)->nullable();
|
||||
$table->string('ceo', 50)->nullable();
|
||||
$table->string('industry', 50)->nullable();
|
||||
$table->string('grade', 20)->default('Silver');
|
||||
$table->string('contact', 50)->nullable();
|
||||
$table->string('email', 100)->nullable();
|
||||
$table->string('address', 200)->nullable();
|
||||
$table->string('manager', 50)->nullable();
|
||||
$table->string('manager_phone', 20)->nullable();
|
||||
$table->string('status', 20)->default('active');
|
||||
$table->text('memo')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index(['tenant_id', 'status']);
|
||||
$table->index(['tenant_id', 'grade']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customers');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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
|
||||
{
|
||||
Schema::create('incomes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id');
|
||||
$table->date('date');
|
||||
$table->string('customer', 100);
|
||||
$table->string('description', 200)->nullable();
|
||||
$table->string('category', 50)->default('기타수입');
|
||||
$table->bigInteger('amount')->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('incomes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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
|
||||
{
|
||||
Schema::create('expenses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id');
|
||||
$table->date('date');
|
||||
$table->string('vendor', 100);
|
||||
$table->string('description', 200)->nullable();
|
||||
$table->string('category', 50)->default('운영비');
|
||||
$table->bigInteger('amount')->default(0);
|
||||
$table->string('status', 20)->default('pending');
|
||||
$table->string('payment_method', 30)->default('계좌이체');
|
||||
$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('expenses');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('sales_records')) {
|
||||
return;
|
||||
}
|
||||
Schema::create('sales_records', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id');
|
||||
$table->date('date');
|
||||
$table->string('customer', 100);
|
||||
$table->string('project', 200)->nullable();
|
||||
$table->string('type', 50)->default('프로젝트');
|
||||
$table->bigInteger('amount')->default(0);
|
||||
$table->bigInteger('vat')->default(0);
|
||||
$table->string('status', 20)->default('negotiating');
|
||||
$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('sales_records');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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
|
||||
{
|
||||
Schema::create('consulting_fees', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id');
|
||||
$table->date('date');
|
||||
$table->string('consultant', 50);
|
||||
$table->string('customer', 100);
|
||||
$table->string('service', 50)->default('기술 컨설팅');
|
||||
$table->integer('hours')->default(0);
|
||||
$table->integer('hourly_rate')->default(0);
|
||||
$table->bigInteger('amount')->default(0);
|
||||
$table->string('status', 20)->default('pending');
|
||||
$table->text('memo')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index(['tenant_id', 'status']);
|
||||
$table->index(['tenant_id', 'date']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('consulting_fees');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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
|
||||
{
|
||||
Schema::create('customer_settlements', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id');
|
||||
$table->string('period', 7);
|
||||
$table->string('customer', 100);
|
||||
$table->bigInteger('total_sales')->default(0);
|
||||
$table->bigInteger('commission')->default(0);
|
||||
$table->bigInteger('expense')->default(0);
|
||||
$table->bigInteger('net_amount')->default(0);
|
||||
$table->string('status', 20)->default('pending');
|
||||
$table->date('settled_date')->nullable();
|
||||
$table->text('memo')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index(['tenant_id', 'status']);
|
||||
$table->index(['tenant_id', 'period']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('customer_settlements');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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
|
||||
{
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('purchases', 'date')) {
|
||||
$table->date('date')->nullable()->after('purchase_date')->comment('매입일(MNG용)');
|
||||
}
|
||||
if (!Schema::hasColumn('purchases', 'vendor')) {
|
||||
$table->string('vendor', 100)->nullable()->after('date')->comment('공급자명(MNG용)');
|
||||
}
|
||||
if (!Schema::hasColumn('purchases', 'item')) {
|
||||
$table->string('item', 200)->nullable()->after('vendor')->comment('품목명(MNG용)');
|
||||
}
|
||||
if (!Schema::hasColumn('purchases', 'category')) {
|
||||
$table->string('category', 50)->default('운영비')->after('item')->comment('분류(MNG용)');
|
||||
}
|
||||
if (!Schema::hasColumn('purchases', 'amount')) {
|
||||
$table->bigInteger('amount')->default(0)->after('category')->comment('금액(MNG용)');
|
||||
}
|
||||
if (!Schema::hasColumn('purchases', 'vat')) {
|
||||
$table->bigInteger('vat')->default(0)->after('amount')->comment('부가세(MNG용)');
|
||||
}
|
||||
if (!Schema::hasColumn('purchases', 'invoice_no')) {
|
||||
$table->string('invoice_no', 50)->nullable()->after('vat')->comment('인보이스번호(MNG용)');
|
||||
}
|
||||
if (!Schema::hasColumn('purchases', 'memo')) {
|
||||
$table->text('memo')->nullable()->after('invoice_no')->comment('메모(MNG용)');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('purchases', function (Blueprint $table) {
|
||||
$columns = ['date', 'vendor', 'item', 'category', 'amount', 'vat', 'invoice_no', 'memo'];
|
||||
foreach ($columns as $col) {
|
||||
if (Schema::hasColumn('purchases', $col)) {
|
||||
$table->dropColumn($col);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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('vat_records')) {
|
||||
return;
|
||||
}
|
||||
Schema::create('vat_records', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id');
|
||||
$table->string('period', 20); // 2026-1H, 2025-2H
|
||||
$table->string('type', 20)->default('sales'); // sales, purchase
|
||||
$table->string('partner_name', 100); // 거래처명
|
||||
$table->string('invoice_no', 50); // 세금계산서번호
|
||||
$table->date('invoice_date')->nullable(); // 발행일
|
||||
$table->bigInteger('supply_amount')->default(0); // 공급가액
|
||||
$table->bigInteger('vat_amount')->default(0); // 부가세
|
||||
$table->bigInteger('total_amount')->default(0); // 합계
|
||||
$table->string('status', 20)->default('pending');// pending, filed, paid
|
||||
$table->text('memo')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index(['tenant_id', 'period']);
|
||||
$table->index(['tenant_id', 'type']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('vat_records');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('daily_fund_transactions')) {
|
||||
return;
|
||||
}
|
||||
Schema::create('daily_fund_transactions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id');
|
||||
$table->date('transaction_date'); // 거래일
|
||||
$table->string('type', 20); // income, expense
|
||||
$table->string('time', 10)->nullable(); // 시간 (HH:MM)
|
||||
$table->unsignedBigInteger('account_id')->nullable(); // 계좌ID (corporate_cards 등과 연동 가능)
|
||||
$table->string('account_name', 50)->nullable(); // 계좌/은행명 (간편 저장용)
|
||||
$table->string('description', 200); // 적요
|
||||
$table->bigInteger('amount')->default(0); // 금액
|
||||
$table->string('category', 50)->nullable(); // 카테고리
|
||||
$table->string('note', 200)->nullable(); // 비고
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index(['tenant_id', 'transaction_date']);
|
||||
$table->index(['tenant_id', 'type']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('daily_fund_transactions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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('daily_fund_memos')) {
|
||||
return;
|
||||
}
|
||||
Schema::create('daily_fund_memos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id');
|
||||
$table->date('memo_date')->comment('해당 날짜');
|
||||
$table->text('memo')->nullable();
|
||||
$table->string('author', 50)->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['tenant_id', 'memo_date']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('daily_fund_memos');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('card_transactions')) {
|
||||
return;
|
||||
}
|
||||
Schema::create('card_transactions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id');
|
||||
$table->unsignedBigInteger('card_id')->nullable(); // corporate_cards.id
|
||||
$table->date('transaction_date'); // 거래일
|
||||
$table->string('time', 10)->nullable(); // 시간 (HH:MM)
|
||||
$table->string('merchant', 200); // 가맹점명
|
||||
$table->string('category', 50)->nullable(); // 카테고리
|
||||
$table->bigInteger('amount')->default(0); // 금액 (음수=취소)
|
||||
$table->string('approval_no', 50)->nullable(); // 승인번호
|
||||
$table->string('status', 20)->default('approved'); // approved, cancelled
|
||||
$table->text('memo')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index(['tenant_id', 'transaction_date']);
|
||||
$table->index(['tenant_id', 'card_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('card_transactions');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user