Files
safekat/ci4/app/Database/Migrations/2025-06-20-184500_LomoMaximoLibros.php

48 lines
1.4 KiB
PHP

<?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();
}
}