-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Forge::dropColumn() seems to always return false. #8931
base: develop
Are you sure you want to change the base?
Conversation
throw new DatabaseException( | ||
'Failed to drop column. Table: "' . $table | ||
. '", Column: "' . $columns . '"' | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dropColumn()
may return false
when $this->db->DBDebug
is false
.
So make this the same, please.
CodeIgniter4/system/Database/Forge.php
Lines 787 to 800 in f60d277
public function dropColumn(string $table, $columnNames) | |
{ | |
$sql = $this->_alterTable('DROP', $this->db->DBPrefix . $table, $columnNames); | |
if ($sql === false) { | |
if ($this->db->DBDebug) { | |
throw new DatabaseException('This feature is not available for the database you are using.'); | |
} | |
return false; | |
} | |
return $this->db->query($sql); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ping-yee Can you complete this PR?
We are very close to the completion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenjis Sorry for the stagnation, I haven’t had much energy to deal with things other than work a while ago.
I modify this right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, the rector removed the return false line, implying that if sqlExecuteResult is false, the method would still return false.
👋 Hi, @ping-yee! |
Description
Fixes #8849
I think return sql execute result directly is a simplest way to fix this issue.
Checklist: