2

So I have my Django app running and I just added South. I performed some migrations which worked fine locally, but I am seeing some database errors on my Heroku version. I'd like to view the current schema for my database both locally and on Heroku so I can compare and see exactly what is different. Is there an easy way to do this from the command line, or a better way to debug this?

1
  • I'm not knowledgeable about Heroku, but if you can shell into it Postgre has a command line tool called psql that will let you view the schema. postgresql.org/docs/9.2/static/app-psql.html Commented Jun 5, 2013 at 14:18

3 Answers 3

3

From the command line you should be able to do heroku pg:psql to connect directly via PSQL to your database and from in there \dt will show you your tables and \d <tablename> will show you your table schema.

Sign up to request clarification or add additional context in comments.

Comments

2

locally django provides a management command that will launch you into your db's shell.

python manage.py dbshell

2 Comments

Thanks - I tried this, but I don't see any commands for viewing the schema.
@user1697845 that can be done once your inside of postgres shell, i haven't used postgress in a while but i think it is \dt? use the \h command for help
0

django also provides a management command that will display the sql for any app you have configure in your project, regardless of the database manager (SQLite, MySQL, etc) that you're using:

python manage.py sqlall <app name>

Try it! It could be usefull!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.