83 lines
2.4 KiB
PHP
83 lines
2.4 KiB
PHP
<?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');
|
||
}
|
||
}
|