-
Notifications
You must be signed in to change notification settings - Fork 0
Rails migrations
Teddy Wing edited this page Apr 3, 2018
·
2 revisions
When modifying Postgres extensions, these queries must be wrapped in an EXISTS
condition. We do this because our development, integration, and production servers get their extensions added outside of the Rails migration system. Without checking for EXISTS
, these migrations would fail.
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