views:

57

answers:

3

I'm switching to RoR from ASP.NET MVC. Yeah, migrations are cool, but I do not need to use different databases in my web applications. Postgresql will do just fine.

So is it okay if I use PGAdmin to create and administer my databases and schema and avoid all these fancy migrate, rake etc?

Update

Thanks everyone! Now I better understand what migrations are, and why I should use them.

+8  A: 

I don't think that's what migration means.

Migrations in rails (and in other frameworks) is a method by which you can use to update your database schema when there are multiple versions of the same database running

For example, you may have two databases, one running on your production server, and another running locally for development. After a few days of coding, your local development database may looks a bit different. With migrations, you can simply push your code to the production server and then run the migrations to automatically update your production database so it is up-to-date with the one you use locally for development.


So, to answer your question, Yes it is OK but you might not get a few of the migrations niceties when the time comes that you'll have to maintain multiple versions of your database.

chakrit
+1  A: 

With migrations you're able to develop your database schema in Ruby and this is usually database indpendent.

In short, spend the 20 minutes or so to really get migrations and the value they add. Then determine whether or not you want to ditch them. Strangely for me I learned Rails before I started my first MVC project; one of the things I missed most was migrations.

From a technical standpoint you should be fine without them.

Andy Gaskell
+2  A: 

Have to agree with charkit but one (rather two) important note why you should use migrations: Migrations don't make up the model definitions. They are stored seperately in a file schema.rb. This defines the rows and tables of your database. When looking into the file, you find these lines:

This file is auto-generated from the current state of the database. Instead of editing this file, please use the migrations feature of Active Record to incrementally modify your database, and then regenerate this schema definition.

The second reason is for testing: you can easily set up a test database to run all your tests against without the need to touch the "real" database. I know when developing, this is not a big problem but this will get more important after some time.


So, yes, it is possible to use PGAdmin to create all your database related stuff but you should not forget to always keep the schema file up to date and come up with a solution for testing.

DrColossos