Update DB\Sqlite\alterField() method
This commit is contained in:
parent
8f838ce769
commit
18710f1a2f
1 changed files with 18 additions and 1 deletions
|
@ -527,7 +527,24 @@ class Sqlite
|
|||
|
||||
$table = $this->tName($table);
|
||||
|
||||
return true; // ???????????????????????????????????????
|
||||
if (! $this->fieldExists($table, $field)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$schema = $this->tableSchema($table);
|
||||
$schema['TABLE']['FIELDS'][$field] = $this->buildColumn($field, [$type, $allowNull, $default, $collate]);
|
||||
$tmpTable = $this->createTmpTable($schema, $table);
|
||||
|
||||
if (! \is_string($tmpTable)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tmp = '"' . \implode('", "', \array_keys($schema['TABLE']['FIELDS'])) . '"';
|
||||
$query = "INSERT INTO \"{$tmpTable}\" ({$tmp})
|
||||
SELECT {$tmp}
|
||||
FROM \"{$table}\"";
|
||||
|
||||
return $this->tmpToTable($schema, $query);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue