terminada envio lineas

This commit is contained in:
2025-04-18 13:38:06 +02:00
parent 15f6d0d675
commit 0b04e6dabd
14 changed files with 1313 additions and 19 deletions

View File

@ -0,0 +1,29 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
use CodeIgniter\Database\RawSql;
class AddMEnvioColumns extends Migration
{
public function up()
{
$this->forge->addColumn("envios",
["multienvio" => [
"type" => "TINYINT",
"unsigned" => true,
"null" => false,
"default" => 0,
]]
);
}
public function down()
{
$this->forge->dropColumn("envios", ['multienvio']);
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddEnviosLineas extends Migration
{
public function up()
{
$this->forge->addField([
'id' => ['type' => 'INT', 'auto_increment' => true],
'envio_id' => ['type' => 'INT', 'unsigned' => true],
'pedido_id' => ['type' => 'INT', 'unsigned' => true],
'presupuesto_id' => ['type' => 'INT', 'unsigned' => true],
'unidades_envio' => ['type' => 'INT', 'default' => 0],
'unidades_total' => ['type' => 'INT', 'default' => 0],
'cajas' => ['type' => 'INT', 'default' => 0],
'unidades_cajas' => ['type' => 'INT', 'default' => 0],
'created_at' => ['type' => 'DATETIME', 'null' => true],
'updated_at' => ['type' => 'DATETIME', 'null' => true],
'created_by' => ['type' => 'INT', 'unsigned' => true, 'null' => true],
'updated_by' => ['type' => 'INT', 'unsigned' => true, 'null' => true],
]);
$this->forge->addKey('id', true); // Primary Key
// Foreign Keys
$this->forge->addForeignKey('presupuesto_id', 'presupuestos', 'id', 'CASCADE', 'CASCADE');
$this->forge->addForeignKey('pedido_id', 'pedidos', 'id', 'CASCADE', 'CASCADE');
$this->forge->addForeignKey('created_by', 'users', 'id', 'SET NULL', 'CASCADE');
$this->forge->addForeignKey('updated_by', 'users', 'id', 'SET NULL', 'CASCADE');
$this->forge->createTable('envios_lineas');
}
public function down()
{
$this->forge->dropTable('envios_lineas');
}
}