wallos/migrations/000015.php
2024-04-20 14:58:46 +02:00

11 lines
504 B
PHP

<?php
// This migration adds a "hide_disabled" column to the settings table and sets to false as default.
/** @noinspection PhpUndefinedVariableInspection */
$columnQuery = $db->query("SELECT * FROM pragma_table_info('settings') where name='hide_disabled'");
$columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false;
if ($columnRequired) {
$db->exec("ALTER TABLE settings ADD COLUMN hide_disabled BOOLEAN DEFAULT 0");
$db->exec('UPDATE settings SET `hide_disabled` = 0');
}