mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
93 lines
6.6 KiB
PHP
93 lines
6.6 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateCatalogoLibros extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->db->query('SET foreign_key_checks = 0');
|
|
|
|
$this->forge->addField([
|
|
'id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'auto_increment' => true],
|
|
'cliente_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'proveedor_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'user_created_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'default' => 1],
|
|
'user_update_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'default' => 1],
|
|
'cubierta_archivo' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'cubierta_url' => ['type' => 'VARCHAR', 'constraint' => 500, 'null' => true],
|
|
'ancho' => ['type' => 'DOUBLE', 'constraint' => '8,2'],
|
|
'alto' => ['type' => 'DOUBLE', 'constraint' => '8,2'],
|
|
'peso' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'null' => true],
|
|
'titulo' => ['type' => 'VARCHAR', 'constraint' => 300],
|
|
'autor' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'autor_entidad' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'traductor' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'ilustrador' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'idioma' => ['type' => 'VARCHAR', 'constraint' => 3, 'default' => 'spa'],
|
|
'num_edic' => ['type' => 'INT', 'default' => 1, 'null' => true],
|
|
'fecha_disponibilidad' => ['type' => 'DATE', 'null' => true],
|
|
'fecha_public' => ['type' => 'DATE', 'null' => true],
|
|
'num_fotos' => ['type' => 'INT', 'default' => 0],
|
|
'num_ilustr' => ['type' => 'INT', 'default' => 0],
|
|
'num_ilustr_color' => ['type' => 'INT', 'default' => 0],
|
|
'num_ilustr_bn' => ['type' => 'INT', 'default' => 0],
|
|
'coleccion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'isk' => ['type' => 'VARCHAR', 'constraint' => 64, 'null' => true],
|
|
'isbn' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'ean' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'editorial' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'resumen' => ['type' => 'TEXT', 'null' => true],
|
|
'resumen_breve' => ['type' => 'TEXT', 'null' => true],
|
|
'sello' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'paginas' => ['type' => 'INT'],
|
|
'tipo_impresion' => ['type' => 'ENUM', 'constraint' => ['negro','negrohq','color','colorhq'], 'null' => true],
|
|
'comentarios' => ['type' => 'TEXT', 'null' => true],
|
|
'negro_paginas' => ['type' => 'INT', 'null' => true],
|
|
'negro_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'negro_gramaje' => ['type' => 'DOUBLE', 'null' => true],
|
|
'negro_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'negro_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
|
|
'color_paginas' => ['type' => 'INT', 'null' => true],
|
|
'color_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'color_gramaje' => ['type' => 'DOUBLE', 'null' => true],
|
|
'color_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'color_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
|
|
'cubierta_paginas' => ['type' => 'INT', 'null' => true],
|
|
'cubierta_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'cubierta_gramaje' => ['type' => 'DOUBLE', 'null' => true],
|
|
'cubierta_acabado_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'cubierta_ancho_solapas' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'default' => 0.00, 'unsigned' => true],
|
|
'cubierta_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'cubierta_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
|
|
'sobrecubierta_paginas' => ['type' => 'INT', 'null' => true],
|
|
'sobrecubierta_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'sobrecubierta_gramaje' => ['type' => 'DOUBLE', 'null' => true],
|
|
'sobrecubierta_acabado_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'sobrecubierta_ancho_solapas' => ['type' => 'DOUBLE', 'constraint' => '8,2', 'default' => 0.00, 'unsigned' => true],
|
|
'sobrecubierta_pod_papel_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'sobrecubierta_pod_gramaje' => ['type' => 'DOUBLE', 'null' => true],
|
|
'encuadernacion_id' => ['type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => true],
|
|
'ubicacion' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
|
|
'created_at' => ['type' => 'TIMESTAMP', 'default' => 'CURRENT_TIMESTAMP'],
|
|
'updated_at' => ['type' => 'TIMESTAMP', 'null' => true],
|
|
'deleted_at' => ['type' => 'TIMESTAMP', 'null' => true],
|
|
]);
|
|
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addUniqueKey('isk');
|
|
$this->forge->addForeignKey('cliente_id', 'clientes', 'id');
|
|
|
|
$this->forge->createTable('catalogo_libros');
|
|
|
|
$this->db->query('SET foreign_key_checks = 1');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('catalogo_libros');
|
|
}
|
|
}
|