Skip to content

OperationalError: near "None": syntax error during migrate (SQLite) #3

@shahbaz-apptech

Description

@shahbaz-apptech

Description

I followed the setup instructions in the README for the django-ledger-starter template, but python manage.py migrate fails with an SQLite syntax error near None.

Steps to Reproduce

  1. Clone the starter repo:
    git clone https://github.com/arrobalytics/django-ledger-starter.git
    cd django-ledger-starter
  2. Install dependencies:
    pip install pipenv
    pipenv install && pipenv shell
  3. Run migrations:
    python manage.py migrate

Expected Behavior

All migrations should apply successfully and create the necessary tables.

Actual Behavior

Migration fails at django_ledger.0026_stagedtransactionmodel_customer_model_and_more with:

django.db.utils.OperationalError: near "None": syntax error

Full Traceback (truncated)

Applying django_ledger.0026_stagedtransactionmodel_customer_model_and_more...Traceback (most recent call last):
  ...
sqlite3.OperationalError: near "None": syntax error

Environment

  • OS: Windows 10
  • Python: 3.11 (Anaconda)
  • Django: Installed via pipenv (version from lockfile)
  • Database: SQLite (default from starter project)

Notes

  • Warning also appears before migrations:
    UserWarning: You are using the deprecated behavior of django_ledger.
    
  • Error might be caused by a field default value or constraint in migration 0026 that renders invalid SQL in SQLite.

Possible Fix

Consider checking migration 0026 in django_ledger/migrations — it may contain a field with default=None or invalid SQL literal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions