/** * Rename the given field. * * @param PropertyField $field The field to rename. * @param string $from The original field key. * @param string $to The new field key. * @return self */ private function renameColumn(PropertyField $field, $from, $to) { $model = $this->targetModel(); $source = $model->source(); $key = $model->key(); $field->setIdent($to); $sql = strtr('ALTER TABLE `%table` CHANGE COLUMN `%from` %field;', ['%table' => $source->table(), '%field' => $field->sql(), '%from' => $from, '%to' => $to]); $source->db()->query($sql); return $this; }