我使用 sqlite 构建了 Rails 应用程序,并且没有指定任何数据库字段大小,我的应用程序现在可以用于生产了吗?
我一直在关注很多关于构建 Rails 应用程序的好教程,但我似乎错过了整个指定和验证数据库字段大小的部分。我喜欢在设计一个应用程序时不需要考虑它(我永远不会用 PHP 或 ASP.net 应用程序来做到这一点)。然而,现在我已经准备好投入生产了,我想我可能因为没有指定字段大小而对自己造成了伤害。我的生产数据库将是 MySQL。这里的最佳实践是什么?我是否需要检查所有迁移文件并指定大小,通过验证更新所有模型,并使用输入最大宽度更新所有表单部分视图?或者我错过了开发过程中的关键步骤?
I've been following a lot of good tutorials on building rails apps but I seem to be missing the whole specifying and validating db field sizes part. I love not needing to have to think about it when roughing out an app (I would have never done this with a PHP or ASP.net app). However, now that I'm ready to go to production, I think I might have done myself a disservice by not specifying field sizes as I went. My production db will be MySQL. What is the best practice here? Do I need to go through all of my migration files and specify sizes, update all the models with validation, and update all my form partial views with input max widths? or am I missing a critical step in my development process?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我觉得你很好。启动 Web 应用程序是一个过程,第一步是将您的应用程序公开给用户并开始运行。随后可以进行改进。你没有被吓到。
一般来说,我没有为每个字段指定最大字段长度。仅在有意义的字段上指定它,否则默认值就很好。
您开发的应用程序并没有关系到生死存亡,不是吗?如果是的话,我想我没有资格回答:)
I think you're fine. Launching a web application is a process and the first step is to expose your app to the user and get the ball rolling. Refinements can follow. You are NOT fubared.
In general, i've NOT specified max field length's for each and every single field. Specify it only on those fields where it makes sense otherwise the default is good.
You're not making applications that come into play as a matter of life and death are you? If yes, then i'm not qualified to answer, i guess :)