trabajando en la lista de tickets

This commit is contained in:
2025-02-15 17:54:49 +01:00
parent a616ec7ba7
commit 4a8aaf906c
15 changed files with 473 additions and 64 deletions

View File

@ -36,8 +36,10 @@ class CreateTicketsSystem extends Migration
$this->forge->addField([
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
'usuario_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
'user_soporte_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
'categoria_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
'estado_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
'seccion_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
'estado_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'default' => 1],
'prioridad' => ['type' => 'ENUM', 'constraint' => ['alta', 'media', 'baja'], 'default' => 'media'],
'titulo' => ['type' => 'VARCHAR', 'constraint' => 255],
'descripcion' => ['type' => 'TEXT'],
@ -45,9 +47,11 @@ class CreateTicketsSystem extends Migration
'updated_at' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addPrimaryKey('id');
$this->forge->addForeignKey('usuario_id', 'users', 'id', 'CASCADE', 'CASCADE');
$this->forge->addForeignKey('categoria_id', 'tickets_categorias', 'id', 'CASCADE', 'CASCADE');
$this->forge->addForeignKey('estado_id', 'tickets_estados', 'id', 'CASCADE', 'CASCADE');
$this->forge->addForeignKey('usuario_id', 'users', 'id', 'NO ACTION', 'NO ACTION');
$this->forge->addForeignKey('user_soporte_id', 'users', 'id', 'NO ACTION', 'NO ACTION');
$this->forge->addForeignKey('categoria_id', 'tickets_categorias', 'id', 'NO ACTION', 'NO ACTION');
$this->forge->addForeignKey('seccion_id', 'tickets_secciones', 'id', 'NO ACTION', 'NO ACTION');
$this->forge->addForeignKey('estado_id', 'tickets_estados', 'id', 'NO ACTION', 'NO ACTION');
$this->forge->createTable('tickets');
// Tabla de Respuestas
@ -59,8 +63,8 @@ class CreateTicketsSystem extends Migration
'created_at' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addPrimaryKey('id');
$this->forge->addForeignKey('ticket_id', 'tickets', 'id', 'CASCADE', 'CASCADE');
$this->forge->addForeignKey('usuario_id', 'users', 'id', 'CASCADE', 'CASCADE');
$this->forge->addForeignKey('ticket_id', 'tickets', 'id', '', 'NO ACTION');
$this->forge->addForeignKey('usuario_id', 'users', 'id', 'NO ACTION', 'NO ACTION');
$this->forge->createTable('tickets_respuestas');
// Tabla de Adjuntos
@ -68,12 +72,15 @@ class CreateTicketsSystem extends Migration
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
'ticket_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
'respuesta_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
'archivo' => ['type' => 'VARCHAR', 'constraint' => 255],
'nombre' => ['type' => 'VARCHAR', 'constraint' => 255],
'hash' => ['type' => 'VARCHAR', 'constraint' => 255],
'path' => ['type' => 'VARCHAR', 'constraint' => 255],
'created_at' => ['type' => 'DATETIME', 'null' => true],
'updated_at' => ['type' => 'DATETIME', 'null' => true],
]);
$this->forge->addPrimaryKey('id');
$this->forge->addForeignKey('ticket_id', 'tickets', 'id', 'CASCADE', 'CASCADE');
$this->forge->addForeignKey('respuesta_id', 'tickets_respuestas', 'id', 'CASCADE', 'CASCADE');
$this->forge->addForeignKey('ticket_id', 'tickets', 'id', 'NO ACTION', 'NO ACTION');
$this->forge->addForeignKey('respuesta_id', 'tickets_respuestas', 'id', 'NO ACTION', 'NO ACTION');
$this->forge->createTable('tickets_adjuntos');
}
@ -84,5 +91,6 @@ class CreateTicketsSystem extends Migration
$this->forge->dropTable('tickets');
$this->forge->dropTable('tickets_categorias');
$this->forge->dropTable('tickets_estados');
$this->forge->dropTable('tickets_secciones');
}
}

View File

@ -37,6 +37,12 @@ class TicketsSeeder extends Seeder
[
'keyword' => 'logistica',
],
[
'keyword' => 'configuracion',
],
[
'keyword' => 'general',
],
];
$this->db->table('tickets_secciones')->insertBatch($data);
@ -56,5 +62,15 @@ class TicketsSeeder extends Seeder
],
];
$this->db->table('tickets_estados')->insertBatch($data);
// config variables
$data = [
[
'name' => 'default_soporte_user_id',
'value' => '10',
'description' => 'ID del usuario por defecto para asignar tickets',
],
];
$this->db->table('config_variables_app')->insertBatch($data);
}
}