diff --git a/db/migrate.php b/db/migrate.php index 7e80351..b8eeea5 100644 --- a/db/migrate.php +++ b/db/migrate.php @@ -1,6 +1,6 @@ exec('ALTER TABLE payment_methods ADD COLUMN enabled BOOLEAN DEFAULT 1'); -$db->exec('UPDATE payment_methods SET enabled = 1'); +$columnQuery = $db->query("SELECT * FROM pragma_table_info('payment_methods') where name='enabled'"); +$columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false; + +if ($columnRequired) { + $db->exec('ALTER TABLE payment_methods ADD COLUMN enabled BOOLEAN DEFAULT 1'); + $db->exec('UPDATE payment_methods SET enabled = 1'); +}