How do I create a database for Rails using MySQL Workbench?

Asked 2 years ago, Updated 2 years ago, 68 views

Thank you for taking care of me.

I would like to create an application with Rails, but I have some doubts about the MySQL database design, so please let me know.

I usually use PHP to create applications, but I used Workbench to design the database at that database.
While creating an ER diagram, you eventually spit out a generation query and run it.

However, Rails will create a model with the command and create a database as db:migrate (is that correct?).
I'd like to continue designing and building on Workbench, but I don't know what to do.

Please lend me your idea.

ruby-on-rails mysql

2022-09-30 20:35

2 Answers

db:schema:dump generates schema.rb from the current DB schema.
This data is diverted to the first file of migration.
※ I will use it to replace the existing system with rails, so I will remember it well.

The migration file is just a generation management element.
schema.rb, the product of rakedb:migrate, is also not required.
※ In fact, I've only encountered an issue that I didn't create once.


2022-09-30 20:35

I've never used Workbench, but when I look for the Internet, there's a tool like this.

http://sourceforge.net/projects/railsexporter/

However, it hasn't been updated for more than a year, and I've never seen anyone around me use it, so I don't think it's a tool that I should be very aggressive about.

In the first place, not using migration means not riding the rails of the Rails.
Failure to ride the rails provided by Rails is likely to result in poor development efficiency and unexpected problems.

If you're familiar with other languages, tools, and frameworks, you'll want to continue the way you've done it, but first of all, if you're in Rome, you'd better follow the new framework.

That's how I started using Rails.


2022-09-30 20:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.