arrobalytics / arrobalytics/django-ledger-starter

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

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
9
Forks
8
PR merge metrics
No merged PRs in 30d

Description

### 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:
```bash
git clone https://github.com/arrobalytics/django-ledger-starter.git
cd django-ledger-starter
```
2. Install dependencies:
```bash
pip install pipenv
pipenv install && pipenv shell
```
3. Run migrations:
```bash
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with `python manage.py migrate`, then inspect `django_ledger/migrations/0026_stagedtransactionmodel_customer_model_and_more.py`, especially fields, defaults, and constraints that may render `None` in SQLite SQL. Done means the migration completes successfully with the starter project's default SQLite database and creates the expected tables.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python, sqlite
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.