From f99102ca33a5501fc0ffbe2b5839a1735ff74e81 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Fri, 23 May 2025 15:31:02 +0900 Subject: [PATCH] Clean up handling of table schemas that are marked as deleted in XML --- common/framework/DB.php | 4 ++-- common/framework/parsers/DBTableParser.php | 6 +++--- common/framework/parsers/dbtable/Table.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/framework/DB.php b/common/framework/DB.php index c58d727b9..f01339d36 100644 --- a/common/framework/DB.php +++ b/common/framework/DB.php @@ -782,11 +782,11 @@ class DB $table = Parsers\DBTableParser::loadXML($filename, $content); if (!$table) { - return $this->setError(-1, 'Table creation failed.'); + return $this->setError(-1, 'Failed to load table schema file'); } 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. diff --git a/common/framework/parsers/DBTableParser.php b/common/framework/parsers/DBTableParser.php index b2245d668..cbd50ea55 100644 --- a/common/framework/parsers/DBTableParser.php +++ b/common/framework/parsers/DBTableParser.php @@ -61,10 +61,10 @@ class DBTableParser extends BaseParser $table->name = strval($xml['name']); } - $deleted = strval($xml['deleted']); - if ($deleted !== '') + $is_deleted = strval($xml['deleted']); + if ($is_deleted !== '') { - $table->deleted = toBool($deleted); + $table->is_deleted = toBool($is_deleted); } // Load columns. diff --git a/common/framework/parsers/dbtable/Table.php b/common/framework/parsers/dbtable/Table.php index 67d1e5ca1..de5e73b43 100644 --- a/common/framework/parsers/dbtable/Table.php +++ b/common/framework/parsers/dbtable/Table.php @@ -12,7 +12,7 @@ class Table public $indexes = array(); public $primary_key = array(); public $constraints = array(); - public $deleted = false; + public $is_deleted = false; /** * Generate the CREATE TABLE query for this table.