Skip to content

db_update_table() function should not require an engine type or comment #2608

@ddb4github

Description

@ddb4github

Update diff to add 'comments'

--- ulib//database.php	2019-03-31 02:45:32.000000000 +0800
+++ ulib//database.php	2019-04-03 19:13:09.000000383 +0800
@@ -894,13 +894,13 @@
 		WHERE TABLE_SCHEMA = SCHEMA()
 		AND TABLE_NAME = '$table'", $log, $db_conn);
 
-	if (isset($info['TABLE_COMMENT']) && str_replace("'", '', $info['TABLE_COMMENT']) != str_replace("'", '', $data['comment'])) {
+	if (isset($info['TABLE_COMMENT']) && isset($data['comment']) && str_replace("'", '', $info['TABLE_COMMENT']) != str_replace("'", '', $data['comment'])) {
 		if (!db_execute("ALTER TABLE `$table` COMMENT '" . str_replace("'", '', $data['comment']) . "'", $log, $db_conn)) {
 			return false;
 		}
 	}
 
-	if (isset($info['ENGINE']) && strtolower($info['ENGINE']) != strtolower($data['type'])) {
+	if (isset($info['ENGINE']) && isset($data['type']) && strtolower($info['ENGINE']) != strtolower($data['type'])) {
 		if (!db_execute("ALTER TABLE `$table` ENGINE = " . $data['type'], $log, $db_conn)) {
 			return false;
 		}

Metadata

Metadata

Assignees

Labels

apiAPI related issuesenhancementGeneral tag for an enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions