mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
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:
@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user