Files
safekat/ci4/app/Database/Migrations/2024-11-30-170000_OrdenTrabajoTable.php
2024-12-11 10:19:55 +01:00

304 lines
7.3 KiB
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoTable extends Migration
{
protected array $COLUMNS = [
"id" => [
"type" => "INT",
"unsigned" => true,
"auto_increment" => true
],
"pedido_id" => [
"type" => "INT",
"constraint" => 10,
"comment" => "Pedido asociado",
],
"user_created_id" => [
"type" => "INT",
"constraint" => 10,
"comment" => "Usuario que ha pasado el pedido a producción",
],
"user_update_id" => [
"type" => "INT",
"constraint" => 10,
"comment" => "Usuario que ha actualizado la orden de trabajo",
],
"maquina_orden_negro_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true,
"comment" => "Maquina para impresion en negro",
],
"maquina_orden_color_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true,
"comment" => "Maquina para impresion en color",
],
"maquina_orden_portada_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true,
"comment" => "Maquina para impresion portada",
],
"maquina_orden_cubierta_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true,
"comment" => "Maquina para impresion cubierta",
],
"negro_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"color_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"portada_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"cubierta_forma_id" => [
"type" => "INT",
"constraint" => 10,
"null" => true
],
"tirada" => [
"type" => "DOUBLE",
],
"negro_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"color_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"portada_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"cubierta_pliegos_pedido" => [
"type" => "DOUBLE",
"null" => true
],
"negro_clicks_pedido" => [
"type" => "DOUBLE",
],
"color_clicks_pedido" => [
"type" => "DOUBLE",
],
"portada_clicks_pedido" => [
"type" => "DOUBLE",
],
"cubierta_clicks_pedido" => [
"type" => "DOUBLE",
],
"pliegos1" => [
"type" => "INT",
"constraint" => 11,
],
"paginas1" => [
"type" => "INT",
"constraint" => 11,
],
"pliegos2" => [
"type" => "INT",
"constraint" => 11,
],
"paginas2" => [
"type" => "INT",
"constraint" => 11,
],
"negro_proveedor_nombre" => [
"type" => "VARCHAR",
"constraint" => 225
],
"color_proveedor_nombre" => [
"type" => "VARCHAR",
"constraint" => 225
],
"portada_proveedor_nombre" => [
"type" => "VARCHAR",
"constraint" => 225
],
"corte_pie" => [
"type" => "DOUBLE",
],
"lomo" => [
"type" => "INT",
"constraint" => 11,
"null" => true,
],
"tipo_entrada" => [
"type" => "ENUM",
"constraint" => ["in", "out"],
"default" => "out"
],
"fecha_entrega_real_warning" => [
"type" => "BOOLEAN",
"default" => false,
],
"fecha_entrega_warning" => [
"type" => "BOOLEAN",
"default" => false
],
"fecha_entrega_warning_revised" => [
"type" => "BOOLEAN",
"default" => false
],
"ferro_disponible" => [
"type" => "TINYINT",
"constraint" => 4,
],
"ferro_disponible_thread_id" => [
"type" => "INT",
"constraint" => 10,
],
"ferro_cp" => [
"type" => "VARCHAR",
"constraint" => 10,
"null" => true
],
"ferro_proveedor" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
],
"ferro_tracking" => [
"type" => "VARCHAR",
"constraint" => 100,
"null" => true,
],
"pre_formato" => [
"type" => "BOOLEAN",
"default" => false
],
"pre_lomo" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_solapa" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_isbn" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_codbarras" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_imposicion" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_imprimir" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_faltan_materiales" => [
"type" => "BOOLEAN",
"default" => 0,
],
"pre_faltan_materiales_note" => [
"type" => "TEXT",
"null" => true,
],
"progreso" => [
"type" => "DOUBLE",
"default" => 0.00,
],
"message_production_send" => [
"type" => "BOOLEAN",
"default" => 0,
],
"finalizado" => [
"type" => "BOOLEAN",
"default" => 0,
],
"comentarios" => [
"type" => "TEXT",
"null" => true,
]
];
public function up()
{
$this->forge->addField($this->COLUMNS);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField([
"created_at" => [
"type" => "TIMESTAMP",
"default" => $currenttime,
],
"updated_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
"deleted_at" => [
"type" => "TIMESTAMP",
"null" => true,
],
]);
$this->forge->addPrimaryKey("id");
// $this->forge->addForeignKey(["maquina_orden_portada_id"],"lg_maquinas",["id"]);
// $this->forge->addForeignKey(["maquina_orden_negro_id"],"lg_maquinas",["id"]);
// $this->forge->addForeignKey(["maquina_orden_cubierta_id"],"lg_maquinas",["id"]);
// $this->forge->addForeignKey(["maquina_orden_color_id"],"lg_maquinas",["id"]);
$this->forge->createTable("ordenes_trabajo", true);
}
public function down()
{
$this->forge->dropTable("ordenes_trabajo");
}
}