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