añadida migración para el tamaño de los lomos. Cambiado nombre de variables en el codigo también

This commit is contained in:
2025-06-20 18:46:05 +02:00
parent d89d140dac
commit 75ac2e0218
3 changed files with 53 additions and 6 deletions

View File

@ -0,0 +1,47 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class LomoMaximoLibros extends Migration
{
public function up()
{
// Renombrar campo
$this->db->table('config_variables_app')
->where('name', 'lomo_maximo')
->set('name', 'lomo_maximo_fresado_cosido')
->update();
// Insertar nuevo campo: lomo_maximo_espiral
$this->db->table('config_variables_app')->insert([
'name' => 'lomo_maximo_espiral',
'value' => '45',
'description' => 'Tamaño máximo (mm) para el lomo de los libros espiral',
'created_at' => date('Y-m-d H:i:s')
]);
// Insertar nuevo campo: lomo_maximo_wireo
$this->db->table('config_variables_app')->insert([
'name' => 'lomo_maximo_wireo',
'value' => '26',
'description' => 'Tamaño máximo (mm) para el lomo de los libros wire-O',
'created_at' => date('Y-m-d H:i:s')
]);
}
public function down()
{
// Revertir nombre
$this->db->table('config_variables_app')
->where('name', 'lomo_maximo_fresado_cosido')
->set('name', 'lomo_maximo')
->update();
// Borrar los nuevos campos
$this->db->table('config_variables_app')->whereIn('name', [
'lomo_maximo_espiral',
'lomo_maximo_wireo'
])->delete();
}
}