start tasks module

This commit is contained in:
root
2026-01-23 08:48:06 +03:00
parent 283b9132a0
commit 725c62a179
22 changed files with 2489 additions and 6 deletions
@@ -0,0 +1,54 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateTaskBoardsTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'organization_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'name' => [
'type' => 'VARCHAR',
'constraint' => 255,
],
'description' => [
'type' => 'TEXT',
'null' => true,
],
'is_default' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('id', true);
$this->forge->addForeignKey('organization_id', 'organizations', 'id', 'CASCADE', 'CASCADE');
$this->forge->createTable('task_boards');
}
public function down()
{
$this->forge->dropTable('task_boards');
}
}
@@ -0,0 +1,60 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateTaskColumnsTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'board_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'name' => [
'type' => 'VARCHAR',
'constraint' => 255,
],
'color' => [
'type' => 'VARCHAR',
'constraint' => 7,
'default' => '#6B7280',
],
'order_index' => [
'type' => 'INT',
'constraint' => 11,
'default' => 0,
],
'is_default' => [
'type' => 'TINYINT',
'constraint' => 1,
'default' => 0,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('id', true);
$this->forge->addForeignKey('board_id', 'task_boards', 'id', 'CASCADE', 'CASCADE');
$this->forge->createTable('task_columns');
}
public function down()
{
$this->forge->dropTable('task_columns');
}
}
@@ -0,0 +1,82 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateTasksTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'organization_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'board_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'column_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'title' => [
'type' => 'VARCHAR',
'constraint' => 255,
],
'description' => [
'type' => 'TEXT',
'null' => true,
],
'priority' => [
'type' => 'ENUM',
'constraint' => ['low', 'medium', 'high', 'urgent'],
'default' => 'medium',
],
'due_date' => [
'type' => 'DATE',
'null' => true,
],
'completed_at' => [
'type' => 'DATETIME',
'null' => true,
],
'order_index' => [
'type' => 'INT',
'constraint' => 11,
'default' => 0,
],
'created_by' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('id', true);
// Все внешние ключи убраны - ссылочная целостность контролируется на уровне приложения
$this->forge->createTable('tasks');
}
public function down()
{
$this->forge->dropTable('tasks');
}
}
@@ -0,0 +1,49 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateTaskAssigneesTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'auto_increment' => true,
],
'task_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'user_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
],
'role' => [
'type' => 'ENUM',
'constraint' => ['assignee', 'watcher'],
'default' => 'assignee',
],
'assigned_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('id', true);
$this->forge->addKey(['task_id', 'user_id']);
$this->forge->addForeignKey('task_id', 'tasks', 'id', 'CASCADE', 'CASCADE');
$this->forge->addForeignKey('user_id', 'users', 'id', 'CASCADE', 'CASCADE');
$this->forge->createTable('task_assignees');
}
public function down()
{
$this->forge->dropTable('task_assignees');
}
}