diff --git a/database/migrations/2025_12_17_000001_create_api_bookmarks_table.php b/database/migrations/2025_12_17_000001_create_api_bookmarks_table.php new file mode 100644 index 00000000..245f8a40 --- /dev/null +++ b/database/migrations/2025_12_17_000001_create_api_bookmarks_table.php @@ -0,0 +1,36 @@ +id(); + $table->foreignId('user_id')->constrained()->onDelete('cascade')->comment('사용자 ID'); + $table->string('endpoint', 500)->comment('API 엔드포인트'); + $table->string('method', 10)->comment('HTTP 메서드'); + $table->string('display_name', 100)->nullable()->comment('표시명'); + $table->integer('display_order')->default(0)->comment('표시 순서'); + $table->string('color', 20)->nullable()->comment('색상 코드'); + $table->timestamps(); + + $table->unique(['user_id', 'endpoint', 'method'], 'api_bookmarks_unique'); + $table->index('user_id'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('api_bookmarks'); + } +}; diff --git a/database/migrations/2025_12_17_000002_create_api_templates_table.php b/database/migrations/2025_12_17_000002_create_api_templates_table.php new file mode 100644 index 00000000..513ea418 --- /dev/null +++ b/database/migrations/2025_12_17_000002_create_api_templates_table.php @@ -0,0 +1,40 @@ +id(); + $table->foreignId('user_id')->constrained()->onDelete('cascade')->comment('사용자 ID'); + $table->string('endpoint', 500)->comment('API 엔드포인트'); + $table->string('method', 10)->comment('HTTP 메서드'); + $table->string('name', 100)->comment('템플릿명'); + $table->text('description')->nullable()->comment('설명'); + $table->json('headers')->nullable()->comment('헤더 (JSON)'); + $table->json('path_params')->nullable()->comment('경로 파라미터 (JSON)'); + $table->json('query_params')->nullable()->comment('쿼리 파라미터 (JSON)'); + $table->json('body')->nullable()->comment('요청 본문 (JSON)'); + $table->boolean('is_shared')->default(false)->comment('공유 여부'); + $table->timestamps(); + + $table->index(['user_id', 'endpoint', 'method'], 'api_templates_user_endpoint'); + $table->index('is_shared'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('api_templates'); + } +}; diff --git a/database/migrations/2025_12_17_000003_create_api_histories_table.php b/database/migrations/2025_12_17_000003_create_api_histories_table.php new file mode 100644 index 00000000..561744c1 --- /dev/null +++ b/database/migrations/2025_12_17_000003_create_api_histories_table.php @@ -0,0 +1,40 @@ +id(); + $table->foreignId('user_id')->constrained()->onDelete('cascade')->comment('사용자 ID'); + $table->string('endpoint', 500)->comment('API 엔드포인트'); + $table->string('method', 10)->comment('HTTP 메서드'); + $table->json('request_headers')->nullable()->comment('요청 헤더 (JSON)'); + $table->json('request_body')->nullable()->comment('요청 본문 (JSON)'); + $table->integer('response_status')->comment('응답 상태 코드'); + $table->json('response_headers')->nullable()->comment('응답 헤더 (JSON)'); + $table->longText('response_body')->nullable()->comment('응답 본문'); + $table->integer('duration_ms')->comment('소요 시간 (ms)'); + $table->string('environment', 50)->comment('환경명'); + $table->timestamp('created_at')->useCurrent()->comment('생성일시'); + + $table->index(['user_id', 'created_at'], 'api_histories_user_created'); + $table->index(['endpoint', 'method'], 'api_histories_endpoint_method'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('api_histories'); + } +}; diff --git a/database/migrations/2025_12_17_000004_create_api_environments_table.php b/database/migrations/2025_12_17_000004_create_api_environments_table.php new file mode 100644 index 00000000..8e45b8f0 --- /dev/null +++ b/database/migrations/2025_12_17_000004_create_api_environments_table.php @@ -0,0 +1,36 @@ +id(); + $table->foreignId('user_id')->constrained()->onDelete('cascade')->comment('사용자 ID'); + $table->string('name', 50)->comment('환경명'); + $table->string('base_url', 500)->comment('기본 URL'); + $table->string('api_key', 500)->nullable()->comment('API Key (암호화 저장)'); + $table->text('auth_token')->nullable()->comment('인증 토큰 (암호화 저장)'); + $table->json('variables')->nullable()->comment('환경 변수 (JSON)'); + $table->boolean('is_default')->default(false)->comment('기본 환경 여부'); + $table->timestamps(); + + $table->index('user_id'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('api_environments'); + } +};