falta terminar albaranes

This commit is contained in:
2025-04-20 22:10:56 +02:00
parent 61abcb3dbd
commit 19fd76e910
21 changed files with 1731 additions and 464 deletions

View File

@ -0,0 +1,29 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddClienteIdToEnvios extends Migration
{
public function up()
{
$this->forge->addColumn('envios', [
'cliente_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true, // IMPORTANTE
'null' => true,
'after' => 'id',
],
]);
$this->db->query('ALTER TABLE envios ADD CONSTRAINT fk_envios_cliente FOREIGN KEY (cliente_id) REFERENCES clientes(id) ON DELETE SET NULL ON UPDATE CASCADE');
}
public function down()
{
$this->db->query('ALTER TABLE envios DROP FOREIGN KEY fk_envios_cliente');
$this->forge->dropColumn('envios', 'cliente_id');
}
}