It looks as though using Release Phase commands (available as of 2 June 2016) is the preferred way of running things like migrations after the slug has been compiled and deployed.
The Buildpack API explicitly suggests avoiding side effects during the build:
Buildpack developers should avoid generating side effects during the build. For example, it is not recommended to perform database migrations in the compile script.
The following example creates a Rails app with a single migration and demonstrates that the migration is run after deployment.
# Create empty Rails app
$ rails new testing-heroku-release-phase --database=postgresql
$ cd testing-heroku-release-phase/
$ git init
$ git add .
$ git commit -m 'Add empty Rails 4.2 app'
# Create scaffolding for person model
$ rails g scaffold person name:string
$ git add .
$ git commit -m 'Add scaffolding for Person'
# Create Procfile with release command
$ cat > Procfile
release: rake db:migrate
$ git add Procfile
$ git commit -m 'Add Procfile'
# Create Heroku app
$ heroku apps:create testing-heroku-release-phase
Creating ⬢ testing-heroku-release-phase... done
https://testing-heroku-release-phase.herokuapp.com/ | https://git.heroku.com/testing-heroku-release-phase.git
# Deploy app to Heroku
$ git push heroku master
<snipped output>
remote: -----> Compressing...
remote: Done: 29.7M
remote: -----> Launching...
remote: ! Release command declared: this new release will not be available until the command succeeds.
remote: Released v5
remote: https://testing-heroku-release-phase.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
remote: Running release command..... done.