mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
105 lines
3.0 KiB
PHP
105 lines
3.0 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateEnviosTable extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'finalizado' => [
|
|
'type' => 'TINYINT',
|
|
'constraint' => 1,
|
|
'default' => 0,
|
|
],
|
|
'codigo_seguimiento' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 100,
|
|
'null' => true,
|
|
],
|
|
'proveedor_id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'null' => true,
|
|
],
|
|
'comentarios' => [
|
|
'type' => 'TEXT',
|
|
'null' => true,
|
|
],
|
|
'att' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 100,
|
|
'null' => true,
|
|
],
|
|
'direccion' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 300,
|
|
'null' => true,
|
|
],
|
|
'ciudad' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 100,
|
|
'null' => true,
|
|
],
|
|
'cp' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 10,
|
|
'null' => true,
|
|
],
|
|
'email' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 150,
|
|
'null' => true,
|
|
],
|
|
'telefono' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 60,
|
|
'null' => true,
|
|
],
|
|
'pais_id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'null' => true,
|
|
],
|
|
'mostrar_precios' => [
|
|
'type' => 'TINYINT',
|
|
'constraint' => 1,
|
|
'default' => 0,
|
|
],
|
|
'mostrar_iva' => [
|
|
'type' => 'TINYINT',
|
|
'constraint' => 1,
|
|
'default' => 0,
|
|
],
|
|
'created_at' => [
|
|
'type' => 'TIMESTAMP',
|
|
'null' => false,
|
|
'default' => '0000-00-00 00:00:00',
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'TIMESTAMP',
|
|
'null' => false,
|
|
'default' => '0000-00-00 00:00:00',
|
|
],
|
|
]);
|
|
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addForeignKey('proveedor_id', 'lg_proveedores', 'id', 'SET NULL', 'SET NULL');
|
|
$this->forge->addForeignKey('pais_id', 'lg_paises', 'id', 'SET NULL', 'SET NULL');
|
|
|
|
$this->forge->createTable('envios');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('envios');
|
|
}
|
|
}
|