mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
falta terminar albaranes
This commit is contained in:
@ -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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user