goodybag / lunchroom

Daily meal deals
https://lunchroom.goodybag.com
0 stars 0 forks source link

Dev Environment Setup: PostgrSQL Schema & Test Data for Catering Server #10

Closed cadorn closed 9 years ago

cadorn commented 9 years ago

$feature https://github.com/goodybag/lunchroom/issues/1

I have postgresql deploying to a VM and can provision roles and databases.

How do I load the schema and test data for the catering server into postgresql?

jrf0110 commented 9 years ago

This is a bit tricky. When cater was first setup, it was super hacked together. I'm not sure if this setup script still works, but you can run:

node db/setup

It's pretty dumb. There's a file called db/tasks/create-tables that lists all of the tables that need to be created, but of course, it hasn't been kept up. Most of the time, we just replicate what's in production to setup an environment for cater via ./bin/prod-to-local

The other tasks in db/setup should still be good. We could easily fix the create tables task by using dirac.createTables() which looks at all tables registered, builds a directed-acyclic-graph based on table references, and creates the tables in the correct order. Just haven't gotten around to it since the prod-to-local script has sufficed for our purposes.

cadorn commented 9 years ago

I can live with ./bin/prod-to-local for now which may even be better as I have real data to play with. I just feel uneasy running that semi-regularly. Can we create a snapshot and init the DB form the snapshot?

Once the deployment of the catering server works using the snapshot you have some time to tweak the fresh setup scripts which should be cleaned up and then used in addition with test data that covers the full spectrum of variation in the data model in as few records as possible.

cadorn commented 9 years ago

$future Complete if and when moving catering server to tooling