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
|
|
@ -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