mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en el formulario de añadir
This commit is contained in:
@ -11,18 +11,26 @@ class CreateTicketsSystem extends Migration
|
||||
// Tabla de Categorías
|
||||
$this->forge->addField([
|
||||
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'nombre' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true],
|
||||
'keyword' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->createTable('categorias');
|
||||
$this->forge->createTable('tickets_categorias');
|
||||
|
||||
// Tabla de secciones
|
||||
$this->forge->addField([
|
||||
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'keyword' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->createTable('tickets_secciones');
|
||||
|
||||
// Tabla de Estados
|
||||
$this->forge->addField([
|
||||
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
||||
'nombre' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true],
|
||||
'keyword' => ['type' => 'VARCHAR', 'constraint' => 100, 'unique' => true],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->createTable('estados');
|
||||
$this->forge->createTable('tickets_estados');
|
||||
|
||||
// Tabla de Tickets
|
||||
$this->forge->addField([
|
||||
@ -38,8 +46,8 @@ class CreateTicketsSystem extends Migration
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->addForeignKey('usuario_id', 'users', 'id', 'CASCADE', 'CASCADE');
|
||||
$this->forge->addForeignKey('categoria_id', 'categorias', 'id', 'CASCADE', 'CASCADE');
|
||||
$this->forge->addForeignKey('estado_id', 'estados', '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->createTable('tickets');
|
||||
|
||||
// Tabla de Respuestas
|
||||
@ -53,7 +61,7 @@ class CreateTicketsSystem extends Migration
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->addForeignKey('ticket_id', 'tickets', 'id', 'CASCADE', 'CASCADE');
|
||||
$this->forge->addForeignKey('usuario_id', 'users', 'id', 'CASCADE', 'CASCADE');
|
||||
$this->forge->createTable('respuestas');
|
||||
$this->forge->createTable('tickets_respuestas');
|
||||
|
||||
// Tabla de Adjuntos
|
||||
$this->forge->addField([
|
||||
@ -65,16 +73,16 @@ class CreateTicketsSystem extends Migration
|
||||
]);
|
||||
$this->forge->addPrimaryKey('id');
|
||||
$this->forge->addForeignKey('ticket_id', 'tickets', 'id', 'CASCADE', 'CASCADE');
|
||||
$this->forge->addForeignKey('respuesta_id', 'respuestas', 'id', 'CASCADE', 'CASCADE');
|
||||
$this->forge->createTable('adjuntos');
|
||||
$this->forge->addForeignKey('respuesta_id', 'tickets_respuestas', 'id', 'CASCADE', 'CASCADE');
|
||||
$this->forge->createTable('tickets_adjuntos');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable('adjuntos');
|
||||
$this->forge->dropTable('respuestas');
|
||||
$this->forge->dropTable('tickets_adjuntos');
|
||||
$this->forge->dropTable('tickets_respuestas');
|
||||
$this->forge->dropTable('tickets');
|
||||
$this->forge->dropTable('categorias');
|
||||
$this->forge->dropTable('estados');
|
||||
$this->forge->dropTable('tickets_categorias');
|
||||
$this->forge->dropTable('tickets_estados');
|
||||
}
|
||||
}
|
||||
|
||||
60
ci4/app/Database/Seeds/TicketsSeeder.php
Normal file
60
ci4/app/Database/Seeds/TicketsSeeder.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use CodeIgniter\Database\Seeder;
|
||||
|
||||
|
||||
class TicketsSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
// categorias
|
||||
$data = [
|
||||
[
|
||||
'keyword' => 'errores',
|
||||
],
|
||||
[
|
||||
'keyword' => 'consultas',
|
||||
],
|
||||
[
|
||||
'keyword' => 'sugerencias',
|
||||
],
|
||||
];
|
||||
$this->db->table('tickets_categorias')->insertBatch($data);
|
||||
|
||||
// secciones
|
||||
$data = [
|
||||
[
|
||||
'keyword' => 'presupuestos',
|
||||
],
|
||||
[
|
||||
'keyword' => 'pedidos',
|
||||
],
|
||||
[
|
||||
'keyword' => 'facturacion',
|
||||
],
|
||||
[
|
||||
'keyword' => 'logistica',
|
||||
],
|
||||
];
|
||||
$this->db->table('tickets_secciones')->insertBatch($data);
|
||||
|
||||
// estados
|
||||
$data = [
|
||||
[
|
||||
'keyword' => 'abierto',
|
||||
],
|
||||
[
|
||||
'keyword' => 'en_proceso',
|
||||
],
|
||||
[
|
||||
'keyword' => 'resuelto',
|
||||
],
|
||||
[
|
||||
'keyword' => 'archivado',
|
||||
],
|
||||
];
|
||||
$this->db->table('tickets_estados')->insertBatch($data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user