-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support renaming columns in migrations #2682
Conversation
/** @inheritdoc */ | ||
public function renameColumn($from, $to) | ||
{ | ||
$this->collection->updateMany([$from => ['$exists' => true]], ['$rename' => [$from => $to]]); | ||
|
||
return $this; | ||
} | ||
|
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.
First, it finds the documents that have the $from
column and then runs a query to rename their column to the $to
.
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.
The test should be more focused, otherwise LGTM.
This reverts commit 7d6f87d.
Thank you @hans-thomas |
Fix #2391
As mentioned in the linked issue, the
renameColumn
doesn't work. I just override that to fix the method.