diff --git a/database/migrations/2026_02_04_230001_create_customers_table.php b/database/migrations/2026_02_04_230001_create_customers_table.php new file mode 100644 index 0000000..b679dff --- /dev/null +++ b/database/migrations/2026_02_04_230001_create_customers_table.php @@ -0,0 +1,36 @@ +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'); + } +}; diff --git a/database/migrations/2026_02_04_230002_create_incomes_table.php b/database/migrations/2026_02_04_230002_create_incomes_table.php new file mode 100644 index 0000000..3f9c297 --- /dev/null +++ b/database/migrations/2026_02_04_230002_create_incomes_table.php @@ -0,0 +1,32 @@ +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'); + } +}; diff --git a/database/migrations/2026_02_04_230003_create_expenses_table.php b/database/migrations/2026_02_04_230003_create_expenses_table.php new file mode 100644 index 0000000..dcb3b72 --- /dev/null +++ b/database/migrations/2026_02_04_230003_create_expenses_table.php @@ -0,0 +1,33 @@ +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'); + } +}; diff --git a/database/migrations/2026_02_04_230004_create_sales_records_table.php b/database/migrations/2026_02_04_230004_create_sales_records_table.php new file mode 100644 index 0000000..b17c6f6 --- /dev/null +++ b/database/migrations/2026_02_04_230004_create_sales_records_table.php @@ -0,0 +1,33 @@ +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'); + } +}; diff --git a/database/migrations/2026_02_04_230005_create_purchases_table.php b/database/migrations/2026_02_04_230005_create_purchases_table.php new file mode 100644 index 0000000..c2d6664 --- /dev/null +++ b/database/migrations/2026_02_04_230005_create_purchases_table.php @@ -0,0 +1,33 @@ +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'); + } +}; diff --git a/database/migrations/2026_02_04_230006_create_consulting_fees_table.php b/database/migrations/2026_02_04_230006_create_consulting_fees_table.php new file mode 100644 index 0000000..01078de --- /dev/null +++ b/database/migrations/2026_02_04_230006_create_consulting_fees_table.php @@ -0,0 +1,33 @@ +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'); + } +}; diff --git a/database/migrations/2026_02_04_230007_create_customer_settlements_table.php b/database/migrations/2026_02_04_230007_create_customer_settlements_table.php new file mode 100644 index 0000000..91dd4a5 --- /dev/null +++ b/database/migrations/2026_02_04_230007_create_customer_settlements_table.php @@ -0,0 +1,33 @@ +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'); + } +}; diff --git a/database/migrations/2026_02_04_230008_create_subscriptions_table.php b/database/migrations/2026_02_04_230008_create_subscriptions_table.php new file mode 100644 index 0000000..3df7905 --- /dev/null +++ b/database/migrations/2026_02_04_230008_create_subscriptions_table.php @@ -0,0 +1,32 @@ +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'); + } +};