fix store ot

This commit is contained in:
amazuecos
2025-03-26 23:29:19 +01:00
parent 09e8af15cc
commit e44421fb4d
7 changed files with 466 additions and 44 deletions

View File

@ -0,0 +1,222 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoUsersTable extends Migration
{
protected array $USER_COLUMNS = [
'id' => [
'type' => 'INT',
'unsigned' => true,
'auto_increment' => true,
],
"orden_trabajo_id" => [
"type" => "INT",
"unsigned" => true,
],
"user_created_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"user_update_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"inaplazable_revised_change_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"ferro_disponible_hecho_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"ferro_disponible_ok_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"ferro_entregado_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"pendiente_ferro_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"ferro_en_cliente_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"ferro_ok_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"interior_bn_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"interior_color_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"preparacion_interior_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"cubierta_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"plastificado_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"encuadernacion_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"corte_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"embalaje_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"envio_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"entrada_manipulado_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"pre_formato_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"pre_lomo_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"pre_solapa_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"pre_codbarras_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"pre_imposicion_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"pre_imprimir_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
"pre_imprimir_user_id" => [
"type" => "INT",
"unsigned" => true,
"constraint" => 10,
"null" => true,
],
];
public function up()
{
$this->forge->dropTable('orden_trabajo_users',true);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField($this->USER_COLUMNS);
$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("orden_trabajo_id", "ordenes_trabajo","id");
$this->forge->createTable("orden_trabajo_users");
}
public function down()
{
$this->forge->dropTable('orden_trabajo_users');
}
}

View File

@ -0,0 +1,174 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class OrdenTrabajoDatesTable extends Migration
{
protected array $COLUMNS = [
'id' => [
'type' => 'INT',
'unsigned' => true,
'auto_increment' => true,
],
"orden_trabajo_id" => [
"type" => "INT",
"unsigned" => true,
],
"fecha_entrada_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_entrega_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_entrega_change_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_entrega_real_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_impresion_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_encuadernado_at" => [
"type" => "DATE",
"null" => true,
],
"fecha_entrega_externo" => [
"type" => "DATE",
"null" => true,
],
"pendiente_ferro_at" => [
"type" => "DATE",
"null" => true,
],
"ferro_en_cliente_at" => [
"type" => "DATE",
"null" => true,
],
"ferro_ok_at" => [
"type" => "DATE",
"null" => true,
],
"interior_bn_at" => [
"type" => "DATE",
"null" => true,
],
"interior_color_at" => [
"type" => "DATE",
"null" => true,
],
"preparacion_interiores_at" => [
"type" => "DATE",
"null" => true,
],
"cubierta_at" => [
"type" => "DATE",
"null" => true,
],
"plastificado_at" => [
"type" => "DATE",
"null" => true,
],
"encuadernacion_at" => [
"type" => "DATE",
"null" => true,
],
"corte_at" => [
"type" => "DATE",
"null" => true,
],
"embalaje_at" => [
"type" => "DATE",
"null" => true,
],
"envio_at" => [
"type" => "DATE",
"null" => true,
],
"entrada_manipulado_at" => [
"type" => "DATE",
"null" => true,
],
"ferro_disponible_hecho_at" => [
"type" => "DATE",
"null" => true,
],
"ferro_disponible_ok_at" => [
"type" => "DATE",
"null" => true,
],
"ferro_entregado_at" => [
"type" => "DATE",
"null" => true,
],
"pre_formato_at" => [
"type" => "DATE",
"null" => true,
],
"pre_lomo_at" => [
"type" => "DATE",
"null" => true,
],
"pre_solapa_at" => [
"type" => "DATE",
"null" => true,
],
"pre_codbarras_at" => [
"type" => "DATE",
"null" => true,
],
"pre_imposicion_at" => [
"type" => "DATE",
"null" => true,
],
];
public function up()
{
$this->forge->dropTable('orden_trabajo_dates',true);
$currenttime = new RawSql("CURRENT_TIMESTAMP");
$this->forge->addField($this->COLUMNS);
$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("orden_trabajo_id", "ordenes_trabajo","id");
$this->forge->createTable("orden_trabajo_dates");
}
public function down()
{
$this->forge->dropTable('orden_trabajo_dates');
}
}