Starting with postgresql as db in ruby


#1

Hello,

the application when we create a workspace, by default includes the sqlite.

I however want to use postgresql from the start, something that can be made by

rails new myapp --database=postgresql

but in our case, I have to go through lots of reconfiguration as indicated here:

https://community.c9.io/t/setting-up-postgresql

I could eventually go to the console and type that rails new myapp --database=postgresql

but it has never worked out for me as it says that, of course, i cant get a new application inside the other application but

if I go to an upper directory I cant see there where the new application is, even if I click on show hidden files, which, wouldn’t be a hidden file but a whole application. Well, I got to see it by clicking on favorites but it is in the middle of the tree bugged by the other application which was created automatically when launched the workspace, so it is not ok like that.

So then, how can we get started working with postgresql instead of sqlite? This is important, because Heroku does not like having to do reconfiguration or mutation of a sqlite 3 into postgresql, could get the whole db messed up, so I prefer to use in development the same db than in production.

thank you very much


#2

If you have already created an application with the default SQLite, take a look at this guide to start using Postgres for your development environment:

Let us know if you have more questions!


#3

Hi,

Thanks for writing in. The ruby workspace template by default creates a ruby project for you. If you’d like to send additional options in the create, the ‘custom’ workspace template is great for that. It just generates an empty project that you can then modify according to your needs. Once a custom workspace is created, you can just go ahead and set up the postgres db, and then run ‘rails new’ as you’d like.

I hope this helps.

Regards,
​Mutahhir