fix : API 마이그레이션 초기화 및 현재 DB 구조 적용
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('api_keys', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('key')->unique();
|
||||
$table->string('description')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('api_keys');
|
||||
}
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('board_comments', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('댓글 고유번호');
|
||||
$table->unsignedBigInteger('post_id')->index('board_comments_post_id_foreign')->comment('게시글 고유번호');
|
||||
$table->unsignedBigInteger('tenant_id')->index('board_comments_tenant_id_foreign')->comment('테넌트 고유번호');
|
||||
$table->unsignedBigInteger('user_id')->nullable()->index('board_comments_user_id_foreign')->comment('작성자 고유번호');
|
||||
$table->unsignedBigInteger('parent_id')->nullable()->index('board_comments_parent_id_foreign')->comment('상위 댓글ID(대댓글)');
|
||||
$table->text('content')->comment('댓글 내용');
|
||||
$table->string('ip_address', 45)->nullable()->comment('작성자 IP');
|
||||
$table->string('status', 20)->default('active')->comment('상태');
|
||||
$table->timestamps();
|
||||
$table->softDeletes()->comment('삭제일시(Soft Delete)');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('board_comments');
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('board_files', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('첨부파일 고유번호');
|
||||
$table->unsignedBigInteger('post_id')->index('board_files_post_id_foreign')->comment('게시글 고유번호');
|
||||
$table->string('file_path')->comment('저장경로');
|
||||
$table->string('file_name')->comment('원본 파일명');
|
||||
$table->integer('file_size')->comment('파일 크기(Byte)');
|
||||
$table->string('file_type', 100)->nullable()->comment('파일 MIME 타입');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('board_files');
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('board_settings', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('커스텀필드 고유번호');
|
||||
$table->unsignedBigInteger('board_id')->comment('게시판 고유번호');
|
||||
$table->string('name', 100)->comment('필드명');
|
||||
$table->string('field_key', 50)->comment('필드키');
|
||||
$table->string('field_type', 20)->comment('필드유형');
|
||||
$table->json('field_meta')->nullable()->comment('필드메타');
|
||||
$table->boolean('is_required')->default(false)->comment('필수여부');
|
||||
$table->integer('sort_order')->default(0)->comment('정렬순서');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['board_id', 'field_key']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('board_settings');
|
||||
}
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('boards', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('게시판 고유번호');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트 고유번호');
|
||||
$table->string('board_code', 30)->comment('게시판 코드');
|
||||
$table->string('name', 100)->comment('게시판 이름');
|
||||
$table->string('description')->nullable()->comment('게시판 설명');
|
||||
$table->string('editor_type', 20)->default('wysiwyg')->comment('에디터 유형');
|
||||
$table->boolean('allow_files')->default(true)->comment('파일첨부 허용 여부');
|
||||
$table->integer('max_file_count')->default(5)->comment('최대 첨부파일 수');
|
||||
$table->integer('max_file_size')->default(20480)->comment('최대 첨부파일 크기(KB)');
|
||||
$table->json('extra_settings')->nullable()->comment('추가 설정(JSON)');
|
||||
$table->boolean('is_active')->default(true)->comment('활성화 여부');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['tenant_id', 'board_code']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('boards');
|
||||
}
|
||||
};
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('bom_items', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('멀티테넌시');
|
||||
$table->unsignedBigInteger('bom_id')->index('bom_items_bom_id_foreign')->comment('BOM ID');
|
||||
$table->unsignedBigInteger('parent_id')->nullable()->index('bom_items_parent_id_foreign')->comment('상위 BOM Item');
|
||||
$table->string('item_type', 20)->comment('item 종류: part, product, bom');
|
||||
$table->unsignedBigInteger('ref_id')->comment('참조 ID');
|
||||
$table->decimal('quantity', 18, 4)->default(1);
|
||||
$table->json('attributes')->nullable()->comment('동적 속성');
|
||||
$table->integer('sort_order')->default(0);
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('bom_items');
|
||||
}
|
||||
};
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('boms', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('멀티테넌시');
|
||||
$table->unsignedBigInteger('product_id')->index('boms_product_id_foreign')->comment('제품ID');
|
||||
$table->string('code', 30)->comment('BOM코드');
|
||||
$table->string('name', 100)->comment('BOM명');
|
||||
$table->unsignedBigInteger('category_id')->index('boms_category_id_foreign')->comment('카테고리ID(common_codes)');
|
||||
$table->json('attributes')->nullable()->comment('동적 속성');
|
||||
$table->string('description')->nullable()->comment('설명');
|
||||
$table->boolean('is_default')->default(false)->comment('기본BOM여부');
|
||||
$table->boolean('is_active')->default(true)->comment('사용여부');
|
||||
$table->unsignedBigInteger('image_file_id')->nullable()->index('boms_image_file_id_foreign')->comment('첨부파일ID');
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['tenant_id', 'product_id', 'code']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('boms');
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
}
|
||||
};
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('common_codes', function (Blueprint $table) {
|
||||
$table->comment('공통코드 트리');
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->comment('멀티테넌시');
|
||||
$table->string('code_group', 30)->default('category')->comment('코드 그룹');
|
||||
$table->string('code', 20)->comment('코드값');
|
||||
$table->string('name', 100)->comment('이름');
|
||||
$table->unsignedBigInteger('parent_id')->nullable()->index('common_codes_parent_id_foreign')->comment('상위코드ID(트리)');
|
||||
$table->json('attributes')->nullable()->comment('동적 속성');
|
||||
$table->string('description')->nullable()->comment('설명');
|
||||
$table->tinyInteger('is_active')->default(1)->comment('사용여부');
|
||||
$table->integer('sort_order')->default(0)->comment('정렬순서');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['tenant_id', 'code_group', 'code']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('common_codes');
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('files', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('멀티테넌시');
|
||||
$table->string('file_path')->comment('저장경로');
|
||||
$table->string('original_name')->comment('원본 파일명');
|
||||
$table->string('file_name')->comment('저장 파일명 (난수)');
|
||||
$table->string('file_name_old');
|
||||
$table->integer('file_size')->nullable();
|
||||
$table->string('mime_type', 50)->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->unsignedBigInteger('fileable_id')->comment('Polymorphic - 연결된 모델의 PK');
|
||||
$table->string('fileable_type', 100)->comment('Polymorphic - 연결된 모델 클래스명');
|
||||
$table->unsignedBigInteger('uploaded_by')->nullable()->comment('업로더 사용자 ID');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('files');
|
||||
}
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('job_batches');
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('log_session', function (Blueprint $table) {
|
||||
$table->comment('세션정보 저장 테이블');
|
||||
$table->string('id', 128)->primary();
|
||||
$table->string('ip_address', 45)->default('0')->comment('IP 주소');
|
||||
$table->string('user_agent', 120)->comment('User Agent');
|
||||
$table->integer('last_activity')->default(0)->index('last_activity_idx')->comment('마지막 활동 시간');
|
||||
$table->string('timestamp', 50)->comment('타임스탬프');
|
||||
$table->text('data')->comment('세션 데이터');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('log_session');
|
||||
}
|
||||
};
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('menus', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('PK: 메뉴 ID');
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->index()->comment('FK: 테넌트 ID(null=공용메뉴)');
|
||||
$table->unsignedBigInteger('parent_id')->nullable()->index()->comment('상위 메뉴 ID');
|
||||
$table->string('name', 100)->comment('메뉴명');
|
||||
$table->string('url')->nullable()->comment('메뉴 URL');
|
||||
$table->boolean('is_active')->default(true)->comment('활성여부(1=활성,0=비활성)');
|
||||
$table->integer('sort_order')->default(0)->comment('정렬순서');
|
||||
$table->boolean('hidden')->default(false)->comment('숨김여부');
|
||||
$table->boolean('is_external')->default(false)->comment('외부링크여부');
|
||||
$table->string('external_url')->nullable()->comment('외부링크 URL');
|
||||
$table->string('icon', 50)->nullable()->comment('아이콘명');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('menus');
|
||||
}
|
||||
};
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('parts', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('멀티테넌시');
|
||||
$table->string('code', 30)->comment('부품코드');
|
||||
$table->string('name', 100)->comment('부품명');
|
||||
$table->unsignedBigInteger('category_id')->index('parts_category_id_foreign')->comment('카테고리ID(common_codes)');
|
||||
$table->unsignedBigInteger('part_type_id')->nullable()->index('parts_part_type_id_foreign')->comment('부품타입ID(common_codes)');
|
||||
$table->string('unit', 20)->nullable()->comment('단위');
|
||||
$table->json('attributes')->nullable()->comment('동적 속성');
|
||||
$table->string('description')->nullable()->comment('설명');
|
||||
$table->tinyInteger('is_active')->default(1)->comment('사용여부');
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['tenant_id', 'code']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('parts');
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
}
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('payments', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('PK');
|
||||
$table->unsignedBigInteger('subscription_id')->index('payments_subscription_id_foreign');
|
||||
$table->decimal('amount', 12)->comment('결제금액');
|
||||
$table->string('payment_method', 30)->comment('결제수단');
|
||||
$table->string('transaction_id', 100)->nullable()->comment('PG 거래ID');
|
||||
$table->dateTime('paid_at')->comment('결제일시');
|
||||
$table->string('status', 20)->default('paid')->comment('결제상태(paid, failed 등)');
|
||||
$table->text('memo')->nullable()->comment('비고');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payments');
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('tokenable_type');
|
||||
$table->unsignedBigInteger('tokenable_id');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['tokenable_type', 'tokenable_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('plans', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('PK');
|
||||
$table->string('name')->comment('플랜명');
|
||||
$table->string('code', 30)->unique()->comment('플랜 코드');
|
||||
$table->text('description')->nullable()->comment('설명');
|
||||
$table->decimal('price', 12)->comment('월 요금');
|
||||
$table->string('billing_cycle', 20)->default('monthly')->comment('청구 주기');
|
||||
$table->json('features')->nullable()->comment('제공 기능/제한사항');
|
||||
$table->boolean('is_active')->default(true)->comment('사용여부');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('plans');
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('post_custom_field_values', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('필드값 고유번호');
|
||||
$table->unsignedBigInteger('post_id')->comment('게시글 고유번호');
|
||||
$table->unsignedBigInteger('field_id')->index('post_custom_field_values_field_id_foreign')->comment('커스텀필드 고유번호');
|
||||
$table->text('value')->nullable()->comment('필드값');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['post_id', 'field_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('post_custom_field_values');
|
||||
}
|
||||
};
|
||||
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('posts', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('게시글 고유번호');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트 고유번호');
|
||||
$table->unsignedBigInteger('board_id')->index('posts_board_id_foreign')->comment('게시판 고유번호');
|
||||
$table->unsignedBigInteger('user_id')->nullable()->comment('작성자 고유번호');
|
||||
$table->string('title')->comment('제목');
|
||||
$table->longText('content')->comment('내용');
|
||||
$table->string('editor_type', 20)->default('wysiwyg')->comment('에디터 유형');
|
||||
$table->string('ip_address', 45)->nullable()->comment('작성자 IP');
|
||||
$table->boolean('is_notice')->default(false)->comment('공지글 여부');
|
||||
$table->boolean('is_secret')->default(false)->comment('비밀글 여부');
|
||||
$table->integer('views')->default(0)->comment('조회수');
|
||||
$table->string('status', 20)->default('active')->index()->comment('상태');
|
||||
$table->timestamps();
|
||||
$table->softDeletes()->comment('삭제일시(Soft Delete)');
|
||||
|
||||
$table->index(['tenant_id', 'board_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('posts');
|
||||
}
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('price_histories', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('멀티테넌시');
|
||||
$table->string('item_type_code', 20)->comment('대상구분(product/part/bom 등, code_group=price_item_type)');
|
||||
$table->unsignedBigInteger('item_id')->comment('대상ID');
|
||||
$table->string('price_type_code', 20)->comment('단가구분(default/20%up/10%discount 등, code_group=price_type)');
|
||||
$table->decimal('price', 18, 4)->comment('단가');
|
||||
$table->date('started_at');
|
||||
$table->date('ended_at')->nullable();
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['tenant_id', 'item_type_code', 'item_id', 'started_at'], 'idx_price_histories_main');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('price_histories');
|
||||
}
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('products', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('멀티테넌시');
|
||||
$table->string('code', 30)->comment('제품코드');
|
||||
$table->string('name', 100)->comment('제품명');
|
||||
$table->unsignedBigInteger('category_id')->index('products_category_id_foreign')->comment('카테고리ID(common_codes)');
|
||||
$table->json('attributes')->nullable()->comment('동적 속성');
|
||||
$table->string('description')->nullable()->comment('설명');
|
||||
$table->tinyInteger('is_active')->default(1)->comment('사용여부');
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['tenant_id', 'code']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('role_menu_permissions', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('PK: 역할-메뉴 권한 ID');
|
||||
$table->unsignedBigInteger('role_id')->comment('FK: 역할 ID');
|
||||
$table->unsignedBigInteger('menu_id')->index('role_menu_permissions_menu_id_foreign')->comment('FK: 메뉴 ID');
|
||||
$table->boolean('access')->default(false)->comment('메뉴 접근 권한');
|
||||
$table->boolean('read')->default(false)->comment('조회 권한');
|
||||
$table->boolean('write')->default(false)->comment('등록/수정/삭제 권한');
|
||||
$table->boolean('export')->default(false)->comment('다운로드 권한');
|
||||
$table->boolean('approve')->default(false)->comment('승인/반려 권한');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['role_id', 'menu_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('role_menu_permissions');
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('PK: 역할 ID');
|
||||
$table->unsignedBigInteger('tenant_id')->index();
|
||||
$table->string('name', 50)->comment('역할명');
|
||||
$table->string('description')->nullable()->comment('설명');
|
||||
$table->timestamps();
|
||||
$table->softDeletes()->comment('삭제일시(소프트삭제)');
|
||||
|
||||
$table->unique(['tenant_id', 'name'], 'uk_roles_tenant_name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->unsignedBigInteger('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('subscriptions', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('PK');
|
||||
$table->unsignedBigInteger('tenant_id')->index('subscriptions_tenant_id_foreign');
|
||||
$table->unsignedBigInteger('plan_id')->index('subscriptions_plan_id_foreign');
|
||||
$table->date('started_at')->comment('구독 시작일');
|
||||
$table->date('ended_at')->nullable()->comment('구독 종료일(해지시)');
|
||||
$table->string('status', 20)->default('active')->comment('상태(active, canceled, expired 등)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('subscriptions');
|
||||
}
|
||||
};
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tenants', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('PK');
|
||||
$table->string('company_name', 100)->comment('회사/조직명');
|
||||
$table->string('code', 50)->unique()->comment('테넌트 코드');
|
||||
$table->string('email', 80)->nullable()->comment('대표 이메일');
|
||||
$table->string('phone', 20)->nullable()->comment('대표 전화번호');
|
||||
$table->string('address')->nullable()->comment('주소');
|
||||
$table->string('business_num', 12)->nullable()->comment('사업자등록번호(10자리)');
|
||||
$table->string('corp_reg_no', 13)->nullable()->comment('법인등록번호(13자리, 법인만)');
|
||||
$table->string('ceo_name', 50)->nullable()->comment('대표자명');
|
||||
$table->string('homepage')->nullable()->comment('홈페이지 주소');
|
||||
$table->string('fax', 30)->nullable()->comment('팩스번호');
|
||||
$table->string('logo')->nullable()->comment('회사 로고 이미지 경로');
|
||||
$table->text('admin_memo')->nullable()->comment('관리자 메모/비고');
|
||||
$table->json('options')->nullable()->comment('회사별 옵션 정보(확장용 JSON)');
|
||||
$table->string('tenant_st_code', 20)->default('trial')->comment('테넌트 상태(trial,active,suspended,cancelled)');
|
||||
$table->unsignedBigInteger('plan_id')->nullable()->comment('현재 요금제(플랜) ID');
|
||||
$table->unsignedBigInteger('subscription_id')->nullable()->comment('현재 구독 정보 ID');
|
||||
$table->integer('max_users')->default(10)->comment('최대 사용자 수');
|
||||
$table->dateTime('trial_ends_at')->nullable()->comment('트라이얼 종료일');
|
||||
$table->dateTime('expires_at')->nullable()->comment('계약 만료일');
|
||||
$table->dateTime('last_paid_at')->nullable()->comment('마지막 결제일');
|
||||
$table->string('billing_tp_code', 20)->default('monthly')->comment('결제 주기(monthly,yearly)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tenants');
|
||||
}
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_menu_permissions', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('PK: 사용자-메뉴 권한 ID');
|
||||
$table->unsignedBigInteger('user_id')->comment('FK: 사용자 ID');
|
||||
$table->unsignedBigInteger('menu_id')->index('user_menu_permissions_menu_id_foreign')->comment('FK: 메뉴 ID');
|
||||
$table->boolean('access')->default(false)->comment('메뉴 접근 권한');
|
||||
$table->boolean('read')->default(false)->comment('조회 권한');
|
||||
$table->boolean('write')->default(false)->comment('등록/수정/삭제 권한');
|
||||
$table->boolean('export')->default(false)->comment('다운로드 권한');
|
||||
$table->boolean('approve')->default(false)->comment('승인/반려 권한');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'menu_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_menu_permissions');
|
||||
}
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_roles', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('PK: 회원별 역할 매핑 ID');
|
||||
$table->unsignedBigInteger('user_id')->comment('FK: 회원ID');
|
||||
$table->unsignedBigInteger('tenant_id')->index('user_roles_tenant_id_foreign')->comment('FK: 테넌트ID');
|
||||
$table->unsignedBigInteger('role_id')->index('user_roles_role_id_foreign')->comment('FK: 역할ID');
|
||||
$table->timestamp('assigned_at')->nullable()->comment('역할 할당일');
|
||||
$table->timestamps();
|
||||
$table->softDeletes()->comment('삭제일시(소프트삭제)');
|
||||
|
||||
$table->unique(['user_id', 'tenant_id', 'role_id'], 'uk_user_tenant_role');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_roles');
|
||||
}
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_tenants', function (Blueprint $table) {
|
||||
$table->bigIncrements('id')->comment('PK: 회원-테넌트 소속 ID');
|
||||
$table->unsignedBigInteger('user_id')->comment('FK: 회원ID');
|
||||
$table->unsignedBigInteger('tenant_id')->index('user_tenants_tenant_id_foreign')->comment('FK: 테넌트ID');
|
||||
$table->boolean('is_active')->default(true)->comment('활성화 여부');
|
||||
$table->timestamp('joined_at')->nullable()->comment('소속일시');
|
||||
$table->timestamp('left_at')->nullable()->comment('탈퇴일시');
|
||||
$table->timestamps();
|
||||
$table->softDeletes()->comment('삭제일시(소프트삭제)');
|
||||
|
||||
$table->unique(['user_id', 'tenant_id'], 'uk_user_tenant');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_tenants');
|
||||
}
|
||||
};
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('user_id', 100)->unique()->comment('회원 아이디');
|
||||
$table->string('phone', 30)->nullable()->comment('회원 전화번호');
|
||||
$table->json('options')->nullable()->comment('회사별 옵션 정보(계좌, 사번 등)');
|
||||
$table->string('name')->comment('회원 이름');
|
||||
$table->string('email')->unique('uk_users_tenant_email')->comment('이메일');
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password')->comment('비밀번호');
|
||||
$table->timestamp('last_login_at')->nullable()->comment('마지막 로그인 일시');
|
||||
$table->text('two_factor_secret')->nullable();
|
||||
$table->text('two_factor_recovery_codes')->nullable();
|
||||
$table->timestamp('two_factor_confirmed_at')->nullable();
|
||||
$table->rememberToken()->comment('자동로그인 토큰');
|
||||
$table->unsignedBigInteger('current_team_id')->nullable();
|
||||
$table->string('profile_photo_path', 2048)->nullable()->comment('프로필 사진 경로');
|
||||
$table->timestamps();
|
||||
$table->softDeletes()->comment('삭제일시(소프트삭제)');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('board_comments', function (Blueprint $table) {
|
||||
$table->foreign(['parent_id'])->references(['id'])->on('board_comments')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['post_id'])->references(['id'])->on('posts')->onUpdate('no action')->onDelete('cascade');
|
||||
$table->foreign(['tenant_id'])->references(['id'])->on('tenants')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['user_id'])->references(['id'])->on('users')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('board_comments', function (Blueprint $table) {
|
||||
$table->dropForeign('board_comments_parent_id_foreign');
|
||||
$table->dropForeign('board_comments_post_id_foreign');
|
||||
$table->dropForeign('board_comments_tenant_id_foreign');
|
||||
$table->dropForeign('board_comments_user_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('board_files', function (Blueprint $table) {
|
||||
$table->foreign(['post_id'])->references(['id'])->on('posts')->onUpdate('no action')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('board_files', function (Blueprint $table) {
|
||||
$table->dropForeign('board_files_post_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('board_settings', function (Blueprint $table) {
|
||||
$table->foreign(['board_id'])->references(['id'])->on('boards')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('board_settings', function (Blueprint $table) {
|
||||
$table->dropForeign('board_settings_board_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('boards', function (Blueprint $table) {
|
||||
$table->foreign(['tenant_id'])->references(['id'])->on('tenants')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('boards', function (Blueprint $table) {
|
||||
$table->dropForeign('boards_tenant_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('bom_items', function (Blueprint $table) {
|
||||
$table->foreign(['bom_id'])->references(['id'])->on('boms')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['parent_id'])->references(['id'])->on('bom_items')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('bom_items', function (Blueprint $table) {
|
||||
$table->dropForeign('bom_items_bom_id_foreign');
|
||||
$table->dropForeign('bom_items_parent_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('boms', function (Blueprint $table) {
|
||||
$table->foreign(['category_id'])->references(['id'])->on('common_codes')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['image_file_id'])->references(['id'])->on('files')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['product_id'])->references(['id'])->on('products')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('boms', function (Blueprint $table) {
|
||||
$table->dropForeign('boms_category_id_foreign');
|
||||
$table->dropForeign('boms_image_file_id_foreign');
|
||||
$table->dropForeign('boms_product_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('common_codes', function (Blueprint $table) {
|
||||
$table->foreign(['parent_id'])->references(['id'])->on('common_codes')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('common_codes', function (Blueprint $table) {
|
||||
$table->dropForeign('common_codes_parent_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('parts', function (Blueprint $table) {
|
||||
$table->foreign(['category_id'])->references(['id'])->on('common_codes')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['part_type_id'])->references(['id'])->on('common_codes')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('parts', function (Blueprint $table) {
|
||||
$table->dropForeign('parts_category_id_foreign');
|
||||
$table->dropForeign('parts_part_type_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('payments', function (Blueprint $table) {
|
||||
$table->foreign(['subscription_id'])->references(['id'])->on('subscriptions')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('payments', function (Blueprint $table) {
|
||||
$table->dropForeign('payments_subscription_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('post_custom_field_values', function (Blueprint $table) {
|
||||
$table->foreign(['field_id'])->references(['id'])->on('board_settings')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['post_id'])->references(['id'])->on('posts')->onUpdate('no action')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('post_custom_field_values', function (Blueprint $table) {
|
||||
$table->dropForeign('post_custom_field_values_field_id_foreign');
|
||||
$table->dropForeign('post_custom_field_values_post_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('posts', function (Blueprint $table) {
|
||||
$table->foreign(['board_id'])->references(['id'])->on('boards')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['tenant_id'])->references(['id'])->on('tenants')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('posts', function (Blueprint $table) {
|
||||
$table->dropForeign('posts_board_id_foreign');
|
||||
$table->dropForeign('posts_tenant_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->foreign(['category_id'])->references(['id'])->on('common_codes')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table->dropForeign('products_category_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('role_menu_permissions', function (Blueprint $table) {
|
||||
$table->foreign(['menu_id'])->references(['id'])->on('menus')->onUpdate('no action')->onDelete('cascade');
|
||||
$table->foreign(['role_id'])->references(['id'])->on('roles')->onUpdate('no action')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('role_menu_permissions', function (Blueprint $table) {
|
||||
$table->dropForeign('role_menu_permissions_menu_id_foreign');
|
||||
$table->dropForeign('role_menu_permissions_role_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('subscriptions', function (Blueprint $table) {
|
||||
$table->foreign(['plan_id'])->references(['id'])->on('plans')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['tenant_id'])->references(['id'])->on('tenants')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('subscriptions', function (Blueprint $table) {
|
||||
$table->dropForeign('subscriptions_plan_id_foreign');
|
||||
$table->dropForeign('subscriptions_tenant_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('user_menu_permissions', function (Blueprint $table) {
|
||||
$table->foreign(['menu_id'])->references(['id'])->on('menus')->onUpdate('no action')->onDelete('cascade');
|
||||
$table->foreign(['user_id'])->references(['id'])->on('users')->onUpdate('no action')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('user_menu_permissions', function (Blueprint $table) {
|
||||
$table->dropForeign('user_menu_permissions_menu_id_foreign');
|
||||
$table->dropForeign('user_menu_permissions_user_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('user_roles', function (Blueprint $table) {
|
||||
$table->foreign(['role_id'])->references(['id'])->on('roles')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['tenant_id'])->references(['id'])->on('tenants')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['user_id'])->references(['id'])->on('users')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('user_roles', function (Blueprint $table) {
|
||||
$table->dropForeign('user_roles_role_id_foreign');
|
||||
$table->dropForeign('user_roles_tenant_id_foreign');
|
||||
$table->dropForeign('user_roles_user_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('user_tenants', function (Blueprint $table) {
|
||||
$table->foreign(['tenant_id'])->references(['id'])->on('tenants')->onUpdate('no action')->onDelete('no action');
|
||||
$table->foreign(['user_id'])->references(['id'])->on('users')->onUpdate('no action')->onDelete('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('user_tenants', function (Blueprint $table) {
|
||||
$table->dropForeign('user_tenants_tenant_id_foreign');
|
||||
$table->dropForeign('user_tenants_user_id_foreign');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
<?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('materials', function (Blueprint $table) {
|
||||
$table->id()->comment('자재 PK');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트ID');
|
||||
$table->string('name', 100)->comment('자재명(품명)');
|
||||
$table->string('specification', 100)->nullable()->comment('규격');
|
||||
$table->string('material_code', 50)->unique()->comment('자재코드');
|
||||
$table->string('unit', 10)->comment('단위');
|
||||
$table->char('is_inspection', 1)->default('N')->comment('검사대상 여부(Y/N)');
|
||||
$table->text('search_tag')->nullable()->comment('검색 태그');
|
||||
$table->text('remarks')->nullable()->comment('비고');
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('materials');
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<?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('lot_sales', function (Blueprint $table) {
|
||||
$table->id()->comment('로트별 판매기록 PK');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트ID');
|
||||
$table->unsignedBigInteger('lot_id')->comment('로트ID');
|
||||
$table->date('sale_date')->comment('판매일');
|
||||
$table->string('author', 50)->nullable()->comment('등록자');
|
||||
$table->string('workplace_name', 60)->nullable()->comment('작업장명');
|
||||
$table->text('remarks')->nullable()->comment('비고');
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index('lot_id', 'idx_sales_lot_id');
|
||||
});
|
||||
}
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('lot_sales');
|
||||
}
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
<?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('lots', function (Blueprint $table) {
|
||||
$table->id()->comment('로트관리 PK');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트ID');
|
||||
$table->string('lot_number', 30)->unique()->comment('로트번호');
|
||||
$table->unsignedBigInteger('material_id')->comment('자재ID');
|
||||
$table->string('specification', 100)->nullable()->comment('규격');
|
||||
$table->string('length', 20)->nullable()->comment('길이');
|
||||
$table->integer('quantity')->comment('수량');
|
||||
$table->string('raw_lot_number', 30)->nullable()->comment('원자재 로트번호');
|
||||
$table->string('fabric_lot', 30)->nullable()->comment('원단 로트');
|
||||
$table->string('author', 50)->nullable()->comment('작성자');
|
||||
$table->text('remarks')->nullable()->comment('비고');
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index('material_id', 'idx_lots_material_id');
|
||||
});
|
||||
}
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('lots');
|
||||
}
|
||||
};
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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('material_inspection_items', function (Blueprint $table) {
|
||||
$table->id()->comment('검사항목 PK');
|
||||
$table->unsignedBigInteger('inspection_id')->comment('수입검사ID');
|
||||
$table->string('item_name', 100)->comment('검사항목명');
|
||||
$table->char('is_checked', 1)->default('N')->comment('체크여부(Y/N)');
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index('inspection_id', 'idx_items_inspection_id');
|
||||
});
|
||||
}
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('material_inspection_items');
|
||||
}
|
||||
};
|
||||
@@ -1,33 +0,0 @@
|
||||
<?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('material_inspections', function (Blueprint $table) {
|
||||
$table->id()->comment('수입검사 PK');
|
||||
$table->unsignedBigInteger('receipt_id')->comment('자재입고ID');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트ID');
|
||||
$table->date('inspection_date')->comment('검사일자');
|
||||
$table->string('inspector_name', 50)->nullable()->comment('검사자');
|
||||
$table->string('approver_name', 50)->nullable()->comment('결재자');
|
||||
$table->string('judgment_code', 30)->comment('종합판정(common_codes)');
|
||||
$table->string('status_code', 30)->comment('상태코드(common_codes)');
|
||||
$table->text('result_file_path')->nullable()->comment('성적서 PDF 경로');
|
||||
$table->text('remarks')->nullable()->comment('비고');
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index('receipt_id', 'idx_inspections_receipt_id');
|
||||
});
|
||||
}
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('material_inspections');
|
||||
}
|
||||
};
|
||||
@@ -1,38 +0,0 @@
|
||||
<?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('material_receipts', function (Blueprint $table) {
|
||||
$table->id()->comment('자재입고 PK');
|
||||
$table->unsignedBigInteger('material_id')->comment('자재ID');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트ID');
|
||||
$table->date('receipt_date')->comment('입고일');
|
||||
$table->string('lot_number', 30)->comment('로트번호');
|
||||
$table->decimal('received_qty', 12, 2)->comment('입고수량');
|
||||
$table->string('unit', 10)->comment('단위');
|
||||
$table->string('supplier_name', 100)->nullable()->comment('납품업체');
|
||||
$table->string('manufacturer_name', 100)->nullable()->comment('제조사');
|
||||
$table->decimal('purchase_price_excl_vat', 12, 2)->nullable()->comment('구매단가(부가세 제외)');
|
||||
$table->decimal('weight_kg', 12, 2)->nullable()->comment('총 무게(kg)');
|
||||
$table->string('status_code', 30)->comment('상태코드(common_codes)');
|
||||
$table->char('is_inspection', 1)->default('N')->comment('검사대상 여부(Y/N)');
|
||||
$table->date('inspection_date')->nullable()->comment('검사일자');
|
||||
$table->text('remarks')->nullable()->comment('비고');
|
||||
$table->unsignedBigInteger('created_by')->comment('생성자(회원PK)');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자(회원PK)');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index('material_id', 'idx_receipts_material_id');
|
||||
});
|
||||
}
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('material_receipts');
|
||||
}
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
<?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('material_receipts', function (Blueprint $table) {
|
||||
$table->foreign('material_id', 'fk_receipts_material_id')->references('id')->on('materials');
|
||||
});
|
||||
Schema::table('material_inspections', function (Blueprint $table) {
|
||||
$table->foreign('receipt_id', 'fk_inspections_receipt_id')->references('id')->on('material_receipts')->onDelete('cascade');
|
||||
});
|
||||
Schema::table('material_inspection_items', function (Blueprint $table) {
|
||||
$table->foreign('inspection_id', 'fk_items_inspection_id')->references('id')->on('material_inspections')->onDelete('cascade');
|
||||
});
|
||||
Schema::table('lots', function (Blueprint $table) {
|
||||
$table->foreign('material_id', 'fk_lots_material_id')->references('id')->on('materials');
|
||||
});
|
||||
Schema::table('lot_sales', function (Blueprint $table) {
|
||||
$table->foreign('lot_id', 'fk_sales_lot_id')->references('id')->on('lots');
|
||||
});
|
||||
}
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('material_receipts', function (Blueprint $table) {
|
||||
$table->dropForeign('fk_receipts_material_id');
|
||||
});
|
||||
Schema::table('material_inspections', function (Blueprint $table) {
|
||||
$table->dropForeign('fk_inspections_receipt_id');
|
||||
});
|
||||
Schema::table('material_inspection_items', function (Blueprint $table) {
|
||||
$table->dropForeign('fk_items_inspection_id');
|
||||
});
|
||||
Schema::table('lots', function (Blueprint $table) {
|
||||
$table->dropForeign('fk_lots_material_id');
|
||||
});
|
||||
Schema::table('lot_sales', function (Blueprint $table) {
|
||||
$table->dropForeign('fk_sales_lot_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
1277
database/schema/mysql-schema.sql
Normal file
1277
database/schema/mysql-schema.sql
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user