Skip to content

Instantly share code, notes, and snippets.

@joncode
Created June 19, 2013 21:03
Show Gist options
  • Select an option

  • Save joncode/5818017 to your computer and use it in GitHub Desktop.

Select an option

Save joncode/5818017 to your computer and use it in GitHub Desktop.
to look at a table scheme in PG in heroku && change a table type Production or Staging --- POSTGRESQL
1. first run the pg version of dbconsole in heroku by using this command :
heroku pg:psql --remote heroku (<staging>)
2. list the tables in psql by using this command
\dt
3. get the proper name of the table and list the schema by using this command
\d <table_name>
viola! - there is your scheme
to CHANGE a column TYPE
ALTER TABLE <table name> ALTER COLUMN <column name> SET DATA TYPE <new type>
NOTE - this did not work for me because i need a type transfer system which i was unable to locate
so I just made rails migrations that dropped the column and added a new column same name with correct data type
@joncode
Copy link
Copy Markdown
Author

joncode commented Jul 24, 2014

to look at the actual data

SELECT * from table_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment