Réparer l’ouverture des fiches animales
This commit is contained in:
parent
e3d8bf45fa
commit
72438556cd
4 changed files with 70 additions and 1 deletions
|
|
@ -601,7 +601,7 @@ trait AnimalBrowseActions
|
|||
$ref_med_administration = $db
|
||||
->query('SELECT id, name, accro FROM ref_med_administration ORDER BY id')
|
||||
->fetchAll();
|
||||
$vaccines = $db->query('SELECT id, name, code FROM ref_vaccines ORDER BY id')->fetchAll();
|
||||
$vaccines = $db->query('SELECT id, name FROM ref_vaccines ORDER BY id')->fetchAll();
|
||||
$inventoryBatches = $db
|
||||
->query(
|
||||
'SELECT b.id,b.batch_number,b.expires_on,b.quantity,p.name,p.unit,p.category,p.reference_id FROM inventory_batches b JOIN inventory_products p ON p.id=b.product_id WHERE b.quantity>0 AND p.active=1 ORDER BY p.category,p.name COLLATE NOCASE,date(b.expires_on)',
|
||||
|
|
|
|||
|
|
@ -47,6 +47,24 @@ final class Migrations
|
|||
}
|
||||
}
|
||||
|
||||
// Les anciennes bases possédaient déjà le nouvel historique alors
|
||||
// que les installations neuves recevaient encore son premier schéma.
|
||||
if ($name === '090_medication_administration_routes.sql') {
|
||||
$columns = array_column(
|
||||
$db->query('PRAGMA table_info(animal_history)')->fetchAll(PDO::FETCH_ASSOC),
|
||||
'name',
|
||||
);
|
||||
if (!in_array('type', $columns, true)) {
|
||||
$db->exec("ALTER TABLE animal_history ADD COLUMN type TEXT NOT NULL DEFAULT 'history'");
|
||||
}
|
||||
if (!in_array('label', $columns, true)) {
|
||||
$db->exec("ALTER TABLE animal_history ADD COLUMN label TEXT NOT NULL DEFAULT ''");
|
||||
}
|
||||
if (!in_array('details', $columns, true)) {
|
||||
$db->exec('ALTER TABLE animal_history ADD COLUMN details TEXT');
|
||||
}
|
||||
}
|
||||
|
||||
$db->beginTransaction();
|
||||
try {
|
||||
$db->exec($sql);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue