Skip to content

Commit

Permalink
Fix trigger registering on non-Postgres databases
Browse files Browse the repository at this point in the history
The trigger in migration 0004 is registered regardless of database backend currently. This adds a check to make sure we are connected to a postgres database before running it.

Type: bug
  • Loading branch information
pmdevita committed May 30, 2024
1 parent e8185ab commit 86e1aac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pghistory/migrations/0004_auto_20220906_1625.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@


def install_pgh_attach_context_func(apps, schema_editor):
Context.install_pgh_attach_context_func(using=schema_editor.connection.alias)
# skip creating stored function for non-postgres database
if schema_editor.connection.vendor.startswith("postgres"):
Context.install_pgh_attach_context_func(using=schema_editor.connection.alias)


class Migration(migrations.Migration):
Expand Down

0 comments on commit 86e1aac

Please sign in to comment.