|
|
|
## Ajout d'une extension PostgreSQL
|
|
|
|
|
|
|
|
Il faut tester lors de l'ajout d'une extension PostgreSQL si elle est déjà présente ou pas.
|
|
|
|
Car sur nos serveurs de développement, intégration ou production ce sera fait par d'autres biais que les migrations.
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
class EnableUnaccentExtension < ActiveRecord::Migration
|
|
|
|
def up
|
|
|
|
execute 'CREATE EXTENSION IF NOT EXISTS unaccent SCHEMA shared_extensions;'
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
execute 'DROP EXTENSION IF EXISTS unaccent SCHEMA shared_extensions;'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
``` |