# Using PostgreSQL with RoR on windows. Help!

**URL:** <https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102>\
**Category:** Rails\
**Created:** [September 21, 2012, 7:45pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102 "2012-09-21T19:45:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [September 21, 2012, 7:45pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102/1 "2012-09-21T19:45:11Z")

</div>

So I just got involved in a huge team project with RoR and PostgreSQL.  
But I can’t find anywhere on the internet to find a proper way to put  
them together. I did find one but it is for iOS :-/

> **[\#342 Migrating to PostgreSQL - RailsCasts](http://railscasts.com/episodes/342-migrating-to-postgresql?view=asciicast)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

I have them both installed and the gem package for postgres also. the  
database.yml is already configured. I just don’t know where to go from  
here. any help would be great thanks.

---

<div class="post-metadata">

**Author:** ![tak\_g](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tak\_g](https://www.ruby-forum.com/u/tak_g)\
**Post date:** [September 21, 2012, 8:04pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102/2 "2012-09-21T20:04:17Z")

</div>

On Fri, Sep 21, 2012 at 1:45 PM, Tak G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> So I just got involved in a huge team project with RoR and PostgreSQL.  
> But I can’t find anywhere on the internet to find a proper way to put  
> them together. I did find one but it is for iOS :-/  
> [http://railscasts.com/episodes/342-migrating-to-postgresql?view=asciicast](http://railscasts.com/episodes/342-migrating-to-postgresql?view=asciicast)
> 
> I have them both installed and the gem package for postgres also. the  
> database.yml is already configured. I just don’t know where to go from  
> here. any help would be great thanks.
> 
> You say you have them installed, but don’t know where to go next? What is  
> it you’re missing? Postgres, from a RoR perspective, isn’t any  
> different  
> than sqlite or mysql. You use migrations and ActiveRecord in the same  
> way.

Perhaps you can be more specific about what you’re trying to do, and  
where  
you are having troubles.

–  
Greg A.  
[http://twitter.com/akinsgre](http://twitter.com/akinsgre)

---

<div class="post-metadata">

**Author:** ![tak\_g](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tak\_g](https://www.ruby-forum.com/u/tak_g)\
**Post date:** [September 21, 2012, 8:08pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102/3 "2012-09-21T20:08:30Z")

</div>

Okay, all I am trying to do is get the web app for the project to start.  
i’ve never done anything with database though which is why i’m kind of  
stuck.

---

<div class="post-metadata">

**Author:** ![tak\_g](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tak\_g](https://www.ruby-forum.com/u/tak_g)\
**Post date:** [September 21, 2012, 8:15pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102/4 "2012-09-21T20:15:59Z")

</div>

I

On Fri, Sep 21, 2012 at 2:08 PM, Tak G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Okay, all I am trying to do is get the web app for the project to start.  
> i’ve never done anything with database though which is why i’m kind of  
> stuck.
> 
> –

Is the database started and can you access it using psql.

If the database is started and the database.yml is configured correctly,  
you should be able to run db:create and db:migrate

–  
Greg A.  
[http://twitter.com/akinsgre](http://twitter.com/akinsgre)

---

<div class="post-metadata">

**Author:** ![tak\_g](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tak\_g](https://www.ruby-forum.com/u/tak_g)\
**Post date:** [September 21, 2012, 8:23pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102/5 "2012-09-21T20:23:00Z")

</div>

On Fri, Sep 21, 2012 at 11:08 AM, Tak G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Okay, all I am trying to do is get the web app for the project to start.

Are you saying you don’t know how to start a Rails app?

Sounds like a basic tutorial would be a good place to begin.

–  
Hassan S. ------------------------ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[Hassan Schroeder | about.me](http://about.me/hassanschroeder)  
twitter: @hassan

---

<div class="post-metadata">

**Author:** ![tak\_g](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tak\_g](https://www.ruby-forum.com/u/tak_g)\
**Post date:** [September 21, 2012, 8:48pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102/6 "2012-09-21T20:48:43Z")

</div>

On Fri, Sep 21, 2012 at 11:34 AM, Tak G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> i mean i know the very basic, which is to just type in rail s. All i’ve  
> done with rail is start a web app without a db. I don’t know anything  
> about creating a db and then migrating

Then you need to learn that first.

> I was told to use the following  
> commands, but since I’m using a windows I cant use these commands
> 
> postgres -D /usr/local/var/postgres

Do you understand what that command does? If so, you should have  
no problem adapting it to your environment. Though if the rest of the  
developers are using \*nix systems, you would probably be better off  
following their lead. 🙂

## Good luck.

Hassan S. ------------------------ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[Hassan Schroeder | about.me](http://about.me/hassanschroeder)  
twitter: @hassan

---

<div class="post-metadata">

**Author:** ![tak\_g](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tak\_g](https://www.ruby-forum.com/u/tak_g)\
**Post date:** [September 21, 2012, 8:34pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102/7 "2012-09-21T20:34:11Z")

</div>

Hassan S. wrote in post #1077004:

> On Fri, Sep 21, 2012 at 11:08 AM, Tak G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Okay, all I am trying to do is get the web app for the project to start.
> 
> Are you saying you don’t know how to start a Rails app?
> 
> Sounds like a basic tutorial would be a good place to begin.
> 
> –  
> Hassan S. ------------------------ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Hassan Schroeder | about.me](http://about.me/hassanschroeder)  
> twitter: @hassan

i mean i know the very basic, which is to just type in rail s. All i’ve  
done with rail is start a web app without a db. I don’t know anything  
about creating a db and then migrating but I think theres something else  
that has to be done prior to it. I was told to use the following  
commands, but since I’m using a windows I cant use these commands

postgres -D /usr/local/var/postgres  
psql theprojectname  
CREATE ROLE cstarleague PASSWORD ‘secret’ LOGIN SUPERUSER;  
and then migrate the db

---

<div class="post-metadata">

**Author:** ![tak\_g](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tak\_g](https://www.ruby-forum.com/u/tak_g)\
**Post date:** [September 21, 2012, 9:34pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102/8 "2012-09-21T21:34:41Z")

</div>

Hassan S. wrote in post #1077008:

> On Fri, Sep 21, 2012 at 11:34 AM, Tak G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > i mean i know the very basic, which is to just type in rail s. All i’ve  
> > done with rail is start a web app without a db. I don’t know anything  
> > about creating a db and then migrating
> 
> Then you need to learn that first.
> 
> > I was told to use the following  
> > commands, but since I’m using a windows I cant use these commands
> > 
> > postgres -D /usr/local/var/postgres
> 
> Do you understand what that command does? If so, you should have  
> no problem adapting it to your environment. Though if the rest of the  
> developers are using \*nix systems, you would probably be better off  
> following their lead. 🙂
> 
> ## Good luck.
> 
> Hassan S. ------------------------ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Hassan Schroeder | about.me](http://about.me/hassanschroeder)  
> twitter: @hassan

sigh this is becoming a huge hassle. the rest of the developers are  
using nix or a mac. why does it matter if i use a windows or a nix?

postgres -D starts up postgres right?

---

<div class="post-metadata">

**Author:** ![tak\_g](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tak\_g](https://www.ruby-forum.com/u/tak_g)\
**Post date:** [September 21, 2012, 9:36pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102/9 "2012-09-21T21:36:40Z")

</div>

On Fri, Sep 21, 2012 at 2:34 PM, Tak G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> postgres -D /usr/local/var/postgres  
> psql theprojectname  
> CREATE ROLE cstarleague PASSWORD ‘secret’ LOGIN SUPERUSER;  
> and then migrate the db

This isn’t Rails.. it’s basic Postgres for 1) Starting the server, 2)  
using  
the commandline tool for executing database commands (SQL) and 3)  
creating  
a user that will be specified in the database.yml

If you can’t get this far, you need to start with a Postgres for Windows  
tutorial.

–  
Greg A.  
[http://twitter.com/akinsgre](http://twitter.com/akinsgre)

---

<div class="post-metadata">

**Author:** ![tak\_g](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@tak\_g](https://www.ruby-forum.com/u/tak_g)\
**Post date:** [September 21, 2012, 9:40pm UTC](https://www.ruby-forum.com/t/using-postgresql-with-ror-on-windows-help/223102/10 "2012-09-21T21:40:10Z")

</div>

On Fri, Sep 21, 2012 at 3:34 PM, Tak G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> sigh this is becoming a huge hassle. the rest of the developers are  
> using nix or a mac. why does it matter if i use a windows or a nix?

Because RoR on Windows is painful. It just doesn’t seem to be supported  
as  
well. You can do it, lots of people have; but most people doing RoR  
seem  
to be using Linux or Mac OS X. And all the advice, tutorials and help  
from  
your fellow developers are going to be biased in that direction.

> postgres -D starts up postgres right?

Yep; though on Windows Postgres can be installed as a Service that is  
started through Windows Service Manager much like other Windows  
processes  
that are meant to run in the background.

–  
Greg A.  
[http://twitter.com/akinsgre](http://twitter.com/akinsgre)
