Created
June 19, 2013 21:03
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to look at the actual data
SELECT * from table_name