微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – Doctrine的addColumn()迁移方法有哪些选项?

API将代码提供为:

public function up()
{
    $this->addColumn('table_name', 'column_name', 'string', $options);
}

但是没有关于可以包含在options数组中的内容的文档.

http://www.doctrine-project.org/Doctrine_Migration_Base/1_2#method_addcolumn

解决方法:

文档错了.查看Doctrine / Migration / base.PHP,您可以看到以下函数原型:

/**
 * Add a add column change.
 *
 * @param string $tableName Name of the table
 * @param string $columnName Name of the column
 * @param string $type Type of the column
 * @param string $length Length of the column
 * @param array $options Array of options for the column
 * @return void
 */
public function addColumn($tableName, $columnName, $type, $length = null, array $options = array())

因此,要添加长度,请将其作为第4个参数.我暂时忽略了这些选项.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐