diff --git a/aleksis/core/migrations/0023_oauth_application_model.py b/aleksis/core/migrations/0023_oauth_application_model.py
index 7e5d2812f4368fac8527b18822b0cc9ad4f116d4..8d57ae8c2b4cd6035814be72537213decd82af52 100644
--- a/aleksis/core/migrations/0023_oauth_application_model.py
+++ b/aleksis/core/migrations/0023_oauth_application_model.py
@@ -1,10 +1,25 @@
 # Generated by Django 3.2.8 on 2021-11-04 09:52
 
+from django.apps import apps as global_apps
 from django.conf import settings
-from django.db import migrations, models
+from django.db import connection, migrations, models
 import django.db.models.deletion
 import oauth2_provider.generators
 
+def migrate_oauth_applications(apps, schema_editor):
+    db_alias = schema_editor.connection.alias
+
+    try:
+        OldApp = apps.get_model("oauth2_provider", "Application")
+    except LookupError:
+        return
+    NewApp = apps.get_model("core", "OAuthApplication")
+
+    if connection.instrospection.table_names() & set(OldApp._meta.db_table):
+        NewApp.objects.using(db_alias).bulk_create(
+            [NewApp(**old_app) for old_app in OldApp.objects.values()]
+        )
+
 
 class Migration(migrations.Migration):
 
@@ -13,9 +28,7 @@ class Migration(migrations.Migration):
         ('core', '0022_public_favicon'),
     ]
 
-    run_before = [
-        ('oauth2_provider', '0001_initial'),
-    ]
+    run_before = []
 
     operations = [
         migrations.CreateModel(
@@ -39,3 +52,11 @@ class Migration(migrations.Migration):
             },
         ),
     ]
+
+    if global_apps.is_installed("oauth2_provider"):
+        operations += [
+            migrations.RunPython(migrate_oauth_applications),
+            migrations.RunSQL("DROP TABLE IF EXISTS oauth2_provider_application;"),
+        ]
+    else:
+        run_before.append(('oauth2_provider', '0001_initial'))