I added a field 'nearbyzips' to my model and now I can't get past these errors. These are the steps I've taken.
manage.py sqlclear accounts
manage.py syncdb
I get no errors from these two commands, but as soon as run manage.py check_permissions, I get:
ProgrammingError: column accounts.my_profile.nearbyzips" does not exist
I've also installed South (even though I don't want to use it) out of desperation and followed the tutorial for converting an existing project to use South. This did not work either so I remove south from my installed apps and deleted the migrations folder in my accounts folder.
My understanding of 'manage.py sqlclear accounts' is that it will delete the actual database table, and syncdb will then rebuild it. This does not seem to be doing what it should be doing otherwise, it would remove the error I would assume. All I did was add a model field, this should not be this difficult.
Does anyone have any other advice? I've read countless stack overflow posts on this subject and the only real solution I'm reading is to use sqlclear which I have done, so I'm worried that I've hit a dead end as far as fixing this issue.
manage.py sqlclear
just prints the SQL DROP
operators but not executes them. To real drop of the app's tables you need to execute these DROPs:
python manage.py sqlclear accounts | python manage.py dbshell
To add the column without dropping the tables you can execute sql
command and then copy the field definition to the ALTER TABLE
operator:
echo "ALTER TABLE accounts_my_profile ADD COLUMN nearbyzips CHAR(100);" | python manage.py dbshell
I solved it,If anyone has the same problem:
you have to completely reset your heroku database with heroku pg:reset DATABASE_URL
do heroku run python manage.py syncdb
do heroku run python manage.py migrate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With