mirror of
https://github.com/ellite/Wallos.git
synced 2026-04-17 21:50:11 -04:00
18 lines
671 B
PHP
18 lines
671 B
PHP
<?php
|
|
// This migration adds "firstname" and "lastname" columns to the user table
|
|
|
|
/** @noinspection PhpUndefinedVariableInspection */
|
|
$columnQuery = $db->query("SELECT * FROM pragma_table_info('user') where name='firstname'");
|
|
$columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false;
|
|
|
|
if ($columnRequired) {
|
|
$db->exec('ALTER TABLE user ADD COLUMN firstname TEXT DEFAULT ""');
|
|
}
|
|
|
|
$columnQuery = $db->query("SELECT * FROM pragma_table_info('user') where name='lastname'");
|
|
$columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false;
|
|
|
|
if ($columnRequired) {
|
|
$db->exec('ALTER TABLE user ADD COLUMN lastname TEXT DEFAULT ""');
|
|
}
|