Skip to content
Snippets Groups Projects
Verified Commit 079c6662 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Fix #663: Do not try to create unaccent extension if it's already present

parent e44b9e04
No related branches found
No related tags found
No related merge requests found
......@@ -3,8 +3,20 @@ from django.db import migrations
from django.contrib.postgres.operations import UnaccentExtension
class CustomUnaccentExtension(UnaccentExtension):
def database_forwards(self, app_label, schema_editor, from_state, to_state):
check_sql = "SELECT 1 FROM pg_extension WHERE extname = 'unaccent'"
with schema_editor.connection.cursor() as cursor:
cursor.execute(check_sql)
result = cursor.fetchall()
if result:
return
return super().database_forwards(app_label, schema_editor, from_state, to_state)
class Migration(migrations.Migration):
dependencies = []
operations = [UnaccentExtension()]
operations = [CustomUnaccentExtension()]
Do not try to create unaccent extension if it's already present (#663)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment