I'm using the Heroku Pipelines feature to auto create a review app whenever I create a new PR in github. This will provision a new DB for you and migrate all your database schema. When migrating this schema I receive this error:
AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'
I want to use PostGIS which means I need to run CREATE EXTENSION postgis;
on the db after it's automatically provisioned. My hunch is that I'm getting this error because the extension isn't installed yet by the time it runs python manage.py migrate
. How would I run this in an automated way when it's building my review app?
It's a bit of a kludge since review apps don't support it natively yet but you could teach your postdeploy
script a new trick. Something like this:
"postdeploy": "echo 'CREATE EXTENSION IF NOT EXISTS postgis;' | psql $DATABASE_URL && --run your migrations here--"
This will pipe in the extension creation prior to running your migrations which should solve the troubles you're seeing.