Skip to content

Instantly share code, notes, and snippets.

@stefanjudis
Created June 6, 2013 17:21
Show Gist options
  • Save stefanjudis/5723233 to your computer and use it in GitHub Desktop.
Save stefanjudis/5723233 to your computer and use it in GitHub Desktop.
Postgres Handling
# get table schema
\d+ travalizit_builds
# list tables in database
\dt
# example insert query for /builds POST
INSERT INTO travalizit_builds VALUES('7840176','510697','129','1','2013-06-06T13:09:41Z','2013-06-06T13:11:05Z','-1','NULL','node_js','2013-06-06T13:11:05Z','174','-1','NULL','-1','-1','NULL')
# execute local script on heroku db
psql -h ec2-23-21-129-229.compute-1.amazonaws.com -p 5432 -d d43fbvfi35vhct -U vgtyranutrpsfv -f travalizit_builds.sql
# add new column
ALTER TABLE travalizit_builds ADD COLUMN commit varchar(45)
# delete clumn
ALTER TABLE distributors DROP COLUMN address
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment