migration drop is_deleted

This commit is contained in:
amazuecos
2025-04-11 07:01:39 +02:00
parent 1e339b5503
commit a4f6f8cdb3

View File

@ -44,6 +44,35 @@ class DropIsDeletedField extends Migration
public function down()
{
$column = [
'is_deleted' => [
'type' => 'BOOLEAN',
'default' => false,
],
];
$this->forge->addColumn('clientes',$column);
$m = $this->db->table('clientes');
$m->where('deleted_at IS NOT NULL',null,false)->update(['is_deleted' => true]);
$m->where('deleted_at',null)->update(['is_deleted' => false]);
$this->forge->addColumn('cliente_contactos',$column);
$m = $this->db->table('cliente_contactos');
$m->where('deleted_at IS NOT NULL',null,false)->update(['is_deleted' => true]);
$m->where('deleted_at',null)->update(['is_deleted' => false]);
$this->forge->addColumn('cliente_precios',$column);
$m = $this->db->table('cliente_precios');
$m->where('deleted_at IS NOT NULL',null,false)->update(['is_deleted' => true]);
$m->where('deleted_at',null)->update(['is_deleted' => false]);
$this->forge->addColumn('cliente_plantilla_precios_lineas',$column);
$m = $this->db->table('cliente_plantilla_precios_lineas');
$m->where('deleted_at IS NOT NULL',null,false)->update(['is_deleted' => true]);
$m->where('deleted_at',null)->update(['is_deleted' => false]);
$this->forge->addColumn('cliente_plantilla_precios',$column);
$m = $this->db->table('cliente_plantilla_precios');
$m->where('deleted_at IS NOT NULL',null,false)->update(['is_deleted' => true]);
$m->where('deleted_at',null)->update(['is_deleted' => false]);
}
}