codeforamerica / fast_pass

Las Vegas Development Opportunity Finder
BSD 3-Clause "New" or "Revised" License
7 stars 4 forks source link

Version database changes with migrations #62

Closed lovehandle closed 10 years ago

lovehandle commented 10 years ago

In order to more effectively share database state changes, we should manifest those changes in migrations stored in version control.

lovehandle commented 10 years ago

CC - @louh

Completed. In order to get the application up and running, you'll need to re-install the dependencies, create environment variables for your local development database environment, and add a default application environment to your environment variables. Please refer to the README for more details.

Future migrations can be run by using the following command:

$ npm run-script db-migrate

To rollback changes from a migration, use the following command:

$ npm run-script db-rollback

To drop the database altogether, use the following command:

$ npm run-script db-drop

All of these commands can be found in the application's package.json file.

louh commented 10 years ago

How does this work with Heroku? Can it just be pushed to Heroku or how does database setup happen on the deployment server?

lovehandle commented 10 years ago

I've set up the Heroku database on lv-dof, but I don't have access to the staging website. If you grant me access I can set it up as well.

Effectively what you do is set environment variables (if you run heroku config --app lv-dof within the project directory you'll see what I did). All of the possible configurations can be referenced within the database.json file.

lovehandle commented 10 years ago

@louh ^^

louh commented 10 years ago

Oh, looks like I added your cfa e-mail. I added your personal email this time.

Quick follow up question. Is username and password something I set up on the psql side or can it be anything I want (specific to the DOF database?)

The db setup threw an error relating to the password, but possibly because I don't remember what it is.

lovehandle commented 10 years ago

@louh we can follow up on this today, but you'll have to set the password environment variable to the password of the user you specify in the accompanying user environment variable. I imagine your postgres user is either 'root' or 'lou', and if you don't remember setting a password, then you probably don't have one (in which case you can leave the password variable blank).