Home > Development, Linux > Preparing Ruby on Rails environment – postgresql

Preparing Ruby on Rails environment – postgresql

January 20th, 2009

Time to start some development, for next project I have decided to use (and learn) Ruby on Rails (RoR).

Many persons use mysql to develop rails apps, as it is easy to setup and use.

But postgresql has more futures then mysql, one of them is known to be used by current RoR, It is transactional DDL update, in Rails world it is called transactionall migrations.

So this is what I had to do to get it working on my gentoo box:

emerge postgresql-server

emerge postgresql-server –config

/etc/init.d/postgresql-8.3 start

su – postgres -c createuser mpapis

# or you could use: sudo -u postgres createuser mpapis

In the listing i have used settings from my computer, /etc/init.d/postgresql-8.3 can be any other name starting with postgres, replace mpapis with your user name.

After running those commands You are able to run psql from yours account, from now on You can run following commands to menage Yours postgresql database:

  1. createdb DATABASE_NAME
  2. dropdb DATABASE_NAME
  3. createuser USER_NAME
  4. dropuser USER_NAME
  5. pg_dump DATABASE_NAME > dump.sql
  6. pg_dumpall > dump.sql
  7. psql -d DATABASE_NAME

This knowledge should be enough to continue with rails, but this comes in next days.

Categories: Development, Linux Tags: , ,
Comments are closed.