迁移格式 Add x to y 中是否存在(必要的)冗余?

发布于 2024-07-22 04:06:53 字数 249 浏览 2 评论 0原文

要将电话列添加到门票表中,我可以这样写:

ruby script/generate migration AddPhoneToTickets phone:string

这里似乎有冗余。 但有必要吗?

我们不是在重复自己吗,要求在迁移名称 (AddPhoneToTickets) 和列定义 (phone:string) 中指定“phone” ?

To add the phone column to the tickets table, I can write:

ruby script/generate migration AddPhoneToTickets phone:string

There seems to be a redundancy here. But is it necessary?

Aren't we repeating ourselves by being required to specify "phone" both in the name of the migration (AddPhoneToTickets) as well as in the column definition (phone:string)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盗心人 2024-07-29 04:06:54

不需要将“电话”放入迁移名称中。 例如,如果您要添加一堆联系人字段,您可以轻松地调用它 AddContactFieldsToTickets 并指定所有字段。 实际上,除了表名称之外,使用迁移名称还不够具体。

You're not required to put Phone in the migration name. For example, if you were adding a bunch of contact fields, you could just as easily call it AddContactFieldsToTickets and specify all the fields. It's not specific enough to use the name of the migration for anything but the table name, really.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文