Does Ruby on Rails have a way to import an existing database schema?

I know that I can do db: create and create database tables or db: transfer to a new version, however, what I want to do is import a schema from an existing database (all tables) and generate models for each of them.

Does ActiveRecord have the ability to do this? Thank!

+5
source share
2 answers

Nope. ActiveRecord is an ORM, so it has nothing to do with creating database schemas or generating models. Rails doesn't have a clue about this either.

You will need to write the database migration and do it yourself.

+3

- . Rails 2.2 ( 2.3 3.0, 2007 ). " " .

, . ActiveRecord Rails 3, .

+1

All Articles