Wagtail backend migration failing with Oracle: parenthesis error

Help! I’m stuck with a migration issue in my Wagtail project using Oracle.

I set up a new Wagtail project and changed the database settings to use Oracle. But when I try to run migrations, I get this error:

ORA-00907: missing right parenthesis

It happens during the wagtailcore.0059_apply_collection_ordering migration. Here’s my setup:

  • Django 3.2.9
  • Oracle 12c
  • cx_Oracle 8.3.0
  • Python 3.7.6

I only changed the database config in settings.py. Could it be a version compatibility issue? Maybe Django 3.0+ doesn’t play nice with Oracle?

Has anyone run into this before? Any ideas on how to fix it? I’m totally stumped!

hmmm interesting problem! have u tried looking at the specific SQL in that migration? sometimes oracle needs tweaks to the syntax. maybe u could share the exact SQL causing trouble? also, wats ur DJANGO_DB_ENGINE setting? make sure its set for oracle correctly. im curious to hear more details!

hey zack, i’ve seen this before. oracle can be tricky with wagtail. have u tried using an older django version, like 2.2? That worked for me when i had similar issues. Also, double-check ur oracle client libs are up to date. Good luck!

I encountered a similar issue when migrating a Wagtail project to Oracle. The problem often stems from incompatibilities between Oracle’s SQL syntax and Django’s migration scripts. One effective solution is to manually modify the problematic migration file. Locate the wagtailcore.0059_apply_collection_ordering migration and adjust the SQL statements to be Oracle-compatible. This might involve rewriting certain clauses or splitting complex queries. Additionally, ensure your Oracle driver (cx_Oracle) is compatible with your Django version. If issues persist, consider using Django’s --fake migration option to skip problematic migrations, then manually apply the necessary schema changes.