Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

Does ActiveRecord have the ability to do this? Thanks!

like image 364
Mike Christensen Avatar asked Jan 29 '11 02:01

Mike Christensen


1 Answers

Nope. ActiveRecord is an ORM, so it doesn't have anything to do with generating database schemas or generating models. Rails doesn't have any concept of doing this, either.

You'll have to write the database migrations and do this yourself.

like image 97
xaxxon Avatar answered Oct 04 '22 02:10

xaxxon