Clean up handling of table schemas that are marked as deleted in XML

This commit is contained in:
Kijin Sung 2025-05-23 15:31:02 +09:00
parent 14cb0e7977
commit f99102ca33
3 changed files with 6 additions and 6 deletions

View file

@ -782,11 +782,11 @@ class DB
$table = Parsers\DBTableParser::loadXML($filename, $content); $table = Parsers\DBTableParser::loadXML($filename, $content);
if (!$table) if (!$table)
{ {
return $this->setError(-1, 'Table creation failed.'); return $this->setError(-1, 'Failed to load table schema file');
} }
if ($table->deleted) if ($table->deleted)
{ {
return new Helpers\DBResultHelper; return new Helpers\DBResultHelper(-1, 'Table is marked as deleted');
} }
// Generate the CREATE TABLE query and execute it. // Generate the CREATE TABLE query and execute it.

View file

@ -61,10 +61,10 @@ class DBTableParser extends BaseParser
$table->name = strval($xml['name']); $table->name = strval($xml['name']);
} }
$deleted = strval($xml['deleted']); $is_deleted = strval($xml['deleted']);
if ($deleted !== '') if ($is_deleted !== '')
{ {
$table->deleted = toBool($deleted); $table->is_deleted = toBool($is_deleted);
} }
// Load columns. // Load columns.

View file

@ -12,7 +12,7 @@ class Table
public $indexes = array(); public $indexes = array();
public $primary_key = array(); public $primary_key = array();
public $constraints = array(); public $constraints = array();
public $deleted = false; public $is_deleted = false;
/** /**
* Generate the CREATE TABLE query for this table. * Generate the CREATE TABLE query for this table.