This is a Discussion
🎩 Description
When some module requires Postgresql extensions like trigram (pg_trgm) or unaccent, a migration is added that adds this extension by executing CREATE EXTENSION IF NOT EXISTS "pg_trgm".
When a developer/sysadmin finds that this migration crashes she has 2 options:
- Grant admin permissions to Decidim's user
- Comment the content of the migration
Both are bad workarounds because
- For 1, giving admin permissions to an application's user is a bad security practice that opens a big security whole to the system. Still worse, this is the preferred workaround because it is what the migration is asking for! "I want to create the trigram extension".
- Even if the trigram extension is already installed in the postgresql instance, the sentence crashes.
Feature proposal:
As this kind of migrations, although not frequent, appear more than once in the Decidim ecosystem (I mean non core/main modules) it would be great to replace them for SELECT * FROM pg_available_extensions and then check if the extension is already installed from the ruby code. If it is already installed, then keep running the following migrations, if not raise an exception asking the sysadmin to enable the given extension with the admin user but not with the current application user.
📋 Additional Data
- 20180227165525 EnablePgExtensions
This is a Discussion
🎩 Description
When some module requires Postgresql extensions like trigram (pg_trgm) or unaccent, a migration is added that adds this extension by executing
CREATE EXTENSION IF NOT EXISTS "pg_trgm".When a developer/sysadmin finds that this migration crashes she has 2 options:
Both are bad workarounds because
Feature proposal:
As this kind of migrations, although not frequent, appear more than once in the Decidim ecosystem (I mean non core/main modules) it would be great to replace them for
SELECT * FROM pg_available_extensionsand then check if the extension is already installed from the ruby code. If it is already installed, then keep running the following migrations, if not raise an exception asking the sysadmin to enable the given extension with the admin user but not with the current application user.📋 Additional Data