oncall-engine/engine/engine/management/commands/create_sqlite_db.py
Vadim Stepanov 53d34164ef
Fix SQLite permission issue (#1984)
# What this PR does
Fixes https://github.com/grafana/oncall/issues/1960.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-05-22 19:16:31 +00:00

15 lines
414 B
Python

from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import connection
class Command(BaseCommand):
"""
Create SQLite3 database file if it doesn't exist.
"""
def handle(self, *args, **options):
assert settings.DATABASE_TYPE == "sqlite3"
# Creating a cursor creates the database file if it doesn't exist.
connection.cursor()