2
0
visuddhinanda 1 жил өмнө
parent
commit
1e4709f01b

+ 66 - 0
api-v8/database/migrations/2024_10_24_124140_create_tasks_table.php

@@ -0,0 +1,66 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateTasksTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * 标题 	手输文本
+     * 类型 	固定标签 project / 翻译主笔
+     * 描述 	任务内容文本
+     * 特别指派 	用户ID 	多个,选填
+     * 角色 	角色标签 	与特别指派互斥
+     * 实际执行人 	用户ID 	单个
+     * 实际执行人关联任务 	ID 	与所关联的任务实际执行人相同
+     * 工程 	ID 	单个
+     * //工程路径 json  这个任务所属的project 的路径 studio/project1/project2
+     * 前置任务ID 		选填
+     * 状态 	列表  待定	待发布、待领取、进行中、待审核、重做、通过、完结
+     * 拥有者 	用户ID 	单个
+     * 修改者 	用户ID 	单个
+     * 里程碑   uuid 	单个
+     * 建立日期
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('tasks', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->string('title',512)->index();
+            $table->string('type',32)->index()->default('project');
+            $table->text('description')->nullable();
+            $table->uuid('parent_id')->index()->nullable();
+            $table->jsonb('assignees_id')->index()->nullable();
+            $table->jsonb('roles')->index()->nullable();
+            $table->uuid('executor_id')->index()->nullable();
+            $table->uuid('executor_relation_task_id')->index()->nullable();
+            $table->uuid('project_id')->index();
+            $table->uuid('pre_task_id')->index()->nullable();
+            $table->uuid('next_task_id')->index()->nullable();
+            $table->boolean('is_milestone')->index()->default(false);
+            $table->uuid('owner_id')->index();
+            $table->uuid('editor_id')->index();
+            $table->integer('order')->index()->default(1);
+            $table->string('status',32)->index()->default('pending');
+            $table->boolean('closed_by_subtask')->default(true);
+            $table->timestamp('started_at')->nullable()->index();
+            $table->timestamp('finished_at')->nullable()->index();
+            $table->softDeletes();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('tasks');
+    }
+}

+ 44 - 0
api-v8/database/migrations/2024_10_25_015946_create_projects_table.php

@@ -0,0 +1,44 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateProjectsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('projects', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->string('title',512)->index();
+            $table->string('type',32)->index()->default('normal');
+            $table->text('description')->nullable();
+            $table->jsonb('executors_id')->index()->nullable();
+            $table->uuid('parent_id')->index()->nullable();
+            $table->jsonb('path')->index()->nullable();
+            $table->jsonb('milestones')->index()->nullable();
+            $table->uuid('owner_id')->index();
+            $table->uuid('editor_id')->index();
+            $table->jsonb('status')->index()->nullable();
+            $table->timestamp('started_at')->nullable()->index();
+            $table->timestamp('finished_at')->nullable()->index();
+            $table->softDeletes();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('projects');
+    }
+}

+ 34 - 0
api-v8/database/migrations/2024_11_27_160039_create_task_assignees_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateTaskAssigneesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('task_assignees', function (Blueprint $table) {
+            $table->uuid('id')->primary()->default(DB::raw('uuid_generate_v1mc()'));
+            $table->uuid('task_id')->index();
+            $table->uuid('assignee_id')->index();
+            $table->uuid('editor_id')->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('task_assignees');
+    }
+}