I know there are many database design tool, database modeling tool. Example, ER-win , db desginer and etc.
我知道有很多数据库设计工具,数据库建模工具。例如,ER-win, db desginer等。
But, they are not supported for Ruby on Rails.
但是,它们不支持Ruby on Rails。
What is the best way or tool to design database for Ruby on Rails?
为Ruby on Rails设计数据库的最好方法或工具是什么?
Appended:
附加:
I know the rails development phases are growing step by step. But, When starting of project, I think database modeling has to be first. Which database modeling tool can I use?
我知道rails的开发阶段正在逐步发展。但是,在项目开始时,我认为数据库建模必须是第一位的。我可以使用哪个数据库建模工具?
5 个解决方案
#1
10
You're working at it backwards. Don't figure out the table structure you need, then build your application around it. The Rails Way is to start building your application's functionality, piece by piece, and add migrations to build up your database as you need it.
你反着做。不要弄清楚所需的表结构,然后围绕它构建应用程序。Rails的方法是开始逐步构建应用程序的功能,并根据需要添加迁移来构建数据库。
You'll end up with a simpler data model, nothing you don't need, and your data structure will reflect the interactions people have with your site instead of the other way around.
您最终将得到一个更简单的数据模型,您不需要任何东西,您的数据结构将反映人们与站点之间的交互,而不是相反。
#2
7
With Rails, you don't. You design the object model, the database model is generated. All database handling is done in the model.
使用Rails,你没有。设计对象模型,生成数据库模型。所有的数据库处理都在模型中完成。
#3
4
With Rails you use migrations to design your database. Give migrations a shot - I thought I would miss the diagrams in SQL Server when I started working with Rails but I don't.
使用Rails,您可以使用迁移来设计数据库。给迁移一个机会——当我开始使用Rails时,我想我会错过SQL Server中的图表,但我没有。
You can see your schema in a very readable text form at db/schema.rb
您可以在db/schema.rb中看到非常可读的文本形式的模式
#4
0
You can certainly use those tools to create your database, but without having experience with how rails deals with relationships you may run into trouble. Not that you can't work around the default way rails does things, but you'll make it a lot tougher on yourself.
您当然可以使用这些工具来创建数据库,但是如果没有rails处理关系的经验,您可能会遇到麻烦。这并不是说您不能按照rails的默认方式工作,而是说您将使自己的工作变得更加困难。
So design your database, but know rails associations.
所以要设计数据库,但要了解rails关联。
#5
0
Like others have said, you should give migrations a shot. The Rails Getting Started guides are extremely helpful in explaining how this works.
就像其他人说的,你应该给迁移一个机会。Rails入门指南非常有助于解释这是如何工作的。
http://guides.rubyonrails.org/getting_started.html
http://guides.rubyonrails.org/getting_started.html
This one is specifically about migrations: http://guides.rubyonrails.org/active_record_migrations.html
这是关于迁移的:http://guides.rubyonrails.org/active_record_migrations.html
Trying doing a basic migration, and you'll see it's incredibly easy. If you need to make changes or alter your migration, then check out that second link that covers more detail about migrations.
尝试做一个基本的迁移,你会发现它非常简单。如果您需要进行更改或更改迁移,那么请查看第二个链接,该链接包含关于迁移的更多细节。
The Rails documentation is also pretty helpful for migrations: http://api.rubyonrails.org/classes/ActiveRecord/Migration.html
Rails文档对于迁移也非常有用:http://api.rubyonrails.org/classes/ActiveRecord/Migration.html
I know documentation on these things can sometimes be terrible, but in this case it's worth taking a look.
我知道关于这些事情的文档有时会很糟糕,但在这种情况下,值得一看。
#1
10
You're working at it backwards. Don't figure out the table structure you need, then build your application around it. The Rails Way is to start building your application's functionality, piece by piece, and add migrations to build up your database as you need it.
你反着做。不要弄清楚所需的表结构,然后围绕它构建应用程序。Rails的方法是开始逐步构建应用程序的功能,并根据需要添加迁移来构建数据库。
You'll end up with a simpler data model, nothing you don't need, and your data structure will reflect the interactions people have with your site instead of the other way around.
您最终将得到一个更简单的数据模型,您不需要任何东西,您的数据结构将反映人们与站点之间的交互,而不是相反。
#2
7
With Rails, you don't. You design the object model, the database model is generated. All database handling is done in the model.
使用Rails,你没有。设计对象模型,生成数据库模型。所有的数据库处理都在模型中完成。
#3
4
With Rails you use migrations to design your database. Give migrations a shot - I thought I would miss the diagrams in SQL Server when I started working with Rails but I don't.
使用Rails,您可以使用迁移来设计数据库。给迁移一个机会——当我开始使用Rails时,我想我会错过SQL Server中的图表,但我没有。
You can see your schema in a very readable text form at db/schema.rb
您可以在db/schema.rb中看到非常可读的文本形式的模式
#4
0
You can certainly use those tools to create your database, but without having experience with how rails deals with relationships you may run into trouble. Not that you can't work around the default way rails does things, but you'll make it a lot tougher on yourself.
您当然可以使用这些工具来创建数据库,但是如果没有rails处理关系的经验,您可能会遇到麻烦。这并不是说您不能按照rails的默认方式工作,而是说您将使自己的工作变得更加困难。
So design your database, but know rails associations.
所以要设计数据库,但要了解rails关联。
#5
0
Like others have said, you should give migrations a shot. The Rails Getting Started guides are extremely helpful in explaining how this works.
就像其他人说的,你应该给迁移一个机会。Rails入门指南非常有助于解释这是如何工作的。
http://guides.rubyonrails.org/getting_started.html
http://guides.rubyonrails.org/getting_started.html
This one is specifically about migrations: http://guides.rubyonrails.org/active_record_migrations.html
这是关于迁移的:http://guides.rubyonrails.org/active_record_migrations.html
Trying doing a basic migration, and you'll see it's incredibly easy. If you need to make changes or alter your migration, then check out that second link that covers more detail about migrations.
尝试做一个基本的迁移,你会发现它非常简单。如果您需要进行更改或更改迁移,那么请查看第二个链接,该链接包含关于迁移的更多细节。
The Rails documentation is also pretty helpful for migrations: http://api.rubyonrails.org/classes/ActiveRecord/Migration.html
Rails文档对于迁移也非常有用:http://api.rubyonrails.org/classes/ActiveRecord/Migration.html
I know documentation on these things can sometimes be terrible, but in this case it's worth taking a look.
我知道关于这些事情的文档有时会很糟糕,但在这种情况下,值得一看。