fix: Определения типов
This commit is contained in:
parent
9f6fd74b17
commit
dd74a97894
28 changed files with 334 additions and 249 deletions
|
|
@ -9,14 +9,15 @@ use Exception;
|
|||
|
||||
class Manager
|
||||
{
|
||||
public $db/*: Database*/;
|
||||
/** @var Database */
|
||||
public $db;
|
||||
|
||||
public function __construct(Database $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
public function executeAction($action/*: array*/, $db_file = "")
|
||||
public function executeAction(array $action, $db_file = "")
|
||||
{
|
||||
switch($action["type"]) {
|
||||
case "dropTable":
|
||||
|
|
@ -117,7 +118,7 @@ class Manager
|
|||
return;
|
||||
}
|
||||
|
||||
$data/*: array*/ = $this->dumpTable($table);
|
||||
$data = $this->dumpTable($table);
|
||||
|
||||
$this->db->query("ALTER TABLE ".$table." RENAME TO ".$tmp_table.";");
|
||||
$table_info[$new_name] = $table_info[$old_name];
|
||||
|
|
@ -169,7 +170,7 @@ class Manager
|
|||
$this->db->query($q);
|
||||
}
|
||||
|
||||
public function getConstraintDef($c/*: array*/)
|
||||
public function getConstraintDef(array $c)
|
||||
{
|
||||
if ($c['type'] == 'unique') {
|
||||
return "UNIQUE(" . implode(", ", $c['fields']) . ")";
|
||||
|
|
@ -209,7 +210,7 @@ class Manager
|
|||
foreach ($table_fields as $name => $value) {
|
||||
$type = strtolower($value['type']);
|
||||
if ($type == "boolean") {
|
||||
foreach ($data as &$row) {
|
||||
foreach ($data as &$row) {
|
||||
if (isset($row[$name])) {
|
||||
$row[$name] = boolval($row[$name]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue