Django Postgres

permission denied to create extension pg_trgm

I recently encountered the error below in Postgres/Django. Specifically, I'm trying to install the latest version of Saleor, an excellently coded online store framework based off Django.

permission denied to create extension "pg_trgm"
HINT:  Must be superuser to create this extension.

The error message is descriptive enough that I already know what to do. I have two options, though. First is to use a database login that has superuser role to connect to my database from Django. This is what I did because I'm just running this instance on my laptop.

The second option is to temporarily add a superuser role to my application user and here's how I did it.

ALTER ROLE saleormoon CREATEROLE superuser;

Of course, you need to login to psql using a superuser to be able to do that. You can then run your migration and then remove the role.

REVOKE superuser FROM saleormoon;