Почему то при проведении миграции она зависает потом выдает ошибку.
Не могу понять в чем дело, в моделях или в чем то еще?
Базу данных и миграции удалял.
Мои модели:
1 - приложение
class CustomUser(models.Model):
telegram_id = models.CharField(
max_length=50, verbose_name="ID пользователя", unique=True, db_index=True
)
name = models.CharField(max_length=50, verbose_name="Имя")
phone_number = models.CharField(
max_length=30, unique=True, verbose_name="Номер телефона"
)
assess = models.BooleanField(verbose_name="Доступ к боту")
work_status = models.CharField(
max_length=50, verbose_name="Статус работы", default="Не в работе"
)
class Meta:
db_table = 'telegram_bot_costumuser'
def __str__(self):
return self.name
class Reminder(models.Model):
user = models.ForeignKey(
CustomUser, on_delete=models.CASCADE, verbose_name="Пользователь"
)
text = models.TextField(verbose_name="Текст напоминания")
due_date = models.DateField(verbose_name="Дата выполнения")
remind_days_before = models.IntegerField(
verbose_name="Количество дней для напоминания"
)
attachment = models.FileField(
upload_to="uploads/reminders/",
verbose_name="Прикрепленный файл",
blank=True,
null=True,
)
def __str__(self):
return f"Напоминание для {self.user.name}: {self.text}"
class Document(models.Model):
file = models.FileField(upload_to="uploads/",
verbose_name="Файл")
description = models.TextField(max_length=50,
verbose_name="Описание")
def __str__(self):
return self.file.name
2 - приложение
class Chart(models.Model):
worker = models.ForeignKey(
CustomUser,
related_name='charts',
verbose_name='Сотрудник',
on_delete=models.CASCADE,
null=True
)
date = models.DateField(verbose_name='Дата')
start_work = models.DateTimeField(
verbose_name='Начало работы',
null=True,
blank=True
)
start_break = models.DateTimeField(
verbose_name='Время начала перерыва',
null=True,
blank=True
)
stop_break = models.DateTimeField(
verbose_name='Время окончания перерыва',
null=True,
blank=True
)
stop_work = models.DateTimeField(
verbose_name='Окончание работы',
null=True,
blank=True
)
Ошибка
Exception in thread Thread-1 (send_shift_notification):
Traceback (most recent call last):
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: telegram_bot_costumuser
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/cleaner_bot/telegram_bot/management/commands/bot.py", line 44, in send_shift_notification
for user in users:
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/models/query.py", line 398, in __iter__
self._fetch_all()
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/models/query.py", line 1926, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/models/query.py", line 91, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 122, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 79, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 92, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 100, in _execute
with self.db.wrap_database_errors:
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/backends/utils.py", line 105, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/Nick_DEV/Documents/DEV/freelance/cleaner_bot/venv/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
return super().execute(query, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: no such table: telegram_bot_costumuser