Enable uuid-ossp on heroku-postgresql automatically for review apps

637 Views Asked by At

I have a heroku review app which gets deployed on every github pull request.

{
  "name": "app_name",
  "description": "",
  "stack": "container",
  "repository": "https://github.com/my_org/my_app.git",
  "buildpack": "heroku/php",
  "image": "php:7.2.11-fpm",
  "addons": [
    {
      "plan": "heroku-redis:hobby-dev",
      "as": "CACHE"
    },
    {
      "plan": "heroku-postgresql:hobby-dev",
      "as": "DATABASE"
    },
    {
      "plan": "scheduler:standard",
      "as": "SCHEDULER"
    }
  ]
}

In order to enable uuid-ossp on the postgres, I have to execute this after every build

heroku pg:psql --app app_name_here
CREATE EXTENSION "uuid-ossp";

How do I have this automatically available when my review app starts? Is there nowhere I can inject a script on start so that postgres will execute it?

0

There are 0 best solutions below