Files
toolbox/database/migrations/2026_01_15_154022_create_projects_table.php

48 lines
1.9 KiB
PHP

<?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('projects', function (Blueprint $table) {
$table->id();
$table->string('slug', 100)->unique()->comment('项目唯一标识,如 portal-be');
$table->string('name', 255)->comment('显示名称');
$table->string('directory', 255)->nullable()->comment('相对于 projects_path 的目录名');
$table->string('absolute_path', 500)->nullable()->comment('绝对路径覆盖(可选)');
$table->string('jira_project_code', 50)->nullable()->comment('JIRA 项目代码');
// Git 监控相关
$table->boolean('git_monitor_enabled')->default(false)->comment('是否启用 Git 监控');
$table->string('git_last_checked_commit', 64)->nullable()->comment('最后检查的 commit SHA');
$table->string('git_current_version', 50)->nullable()->comment('当前版本号');
$table->string('git_release_branch', 255)->nullable()->comment('Release 分支名');
$table->timestamp('git_version_cached_at')->nullable()->comment('版本缓存时间');
// 日志分析相关
$table->json('log_app_names')->nullable()->comment('关联的 App 名称列表');
$table->string('log_env', 50)->default('production')->comment('日志分析环境');
$table->timestamps();
$table->index('jira_project_code', 'idx_jira_project_code');
$table->index('git_monitor_enabled', 'idx_git_monitor_enabled');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('projects');
}
};