Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no such table: employee_employee #457

Open
christabeladdo opened this issue Jan 9, 2025 · 6 comments
Open

no such table: employee_employee #457

christabeladdo opened this issue Jan 9, 2025 · 6 comments

Comments

@christabeladdo
Copy link

Bug Report

django.db.utils.OperationalError: no such table: employee_employee

Description

When I run python "manage.py makemigrations" it ends in an error on windows 11

Steps to Reproduce

  1. I run python manage.py makemigrations on windows 11

Expected Behavior

All the databases must be created and it must end without errors

Actual Behavior

It ends in a error saying "django.db.utils.OperationalError: no such table: employee_employee"

I have downloaded and installed several times but I end up with this error.

Screenshots

image

image

[If applicable, provide screenshots illustrating the issue.]

Environment

  • Django Version: [Django version you're using, e.g., 3.2.1]
    4.2.11
  • Python Version: [Python version, e.g., 3.9]

Python 3.12.8

  • Operating System: [Your OS, e.g., Windows 10, Ubuntu 20.04]
    Windows 11 Pro
  • Browser: [If applicable, specify the browser and version you're using.]

Additional Information

C:\Users\Head of IT\horilla>python manage.py makemigrations
C:\Users\Head of IT\horilla\horilla_views\templatetags\generic_template_filters.py:24: SyntaxWarning: invalid escape sequence '\d'
numeric_test = re.compile("^\d+$")
Traceback (most recent call last):
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\sqlite3\base.py", line 328, in execute
return super().execute(query, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: employee_employee

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\Head of IT\horilla\manage.py", line 22, in
main()
File "C:\Users\Head of IT\horilla\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management_init_.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management_init_.py", line 416, in execute
django.setup()
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django_init_.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\apps\registry.py", line 124, in populate
app_config.ready()
File "C:\Users\Head of IT\horilla\recruitment\apps.py", line 26, in ready
from horilla.urls import urlpatterns
File "C:\Users\Head of IT\horilla\horilla\urls.py", line 35, in
path("", include("base.urls")),
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\importlib_init_.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\horilla\base\urls.py", line 5, in
from base import announcement, request_and_approve, views
File "C:\Users\Head of IT\horilla\base\announcement.py", line 17, in
from base.forms import AnnouncementCommentForm, AnnouncementForm
File "C:\Users\Head of IT\horilla\base\forms.py", line 2175, in
class MultipleApproveConditionForm(ModelForm):
File "C:\Users\Head of IT\horilla\base\forms.py", line 2187, in MultipleApproveConditionForm
(employee.pk, str(employee)) for employee in Employee.objects.all()
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\models\query.py", line 398, in iter
self._fetch_all()
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\models\query.py", line 1881, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\models\query.py", line 91, in iter
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\models\sql\compiler.py", line 1562, in execute_sql
cursor.execute(sql, params)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 102, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 84, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\sqlite3\base.py", line 328, in execute
return super().execute(query, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: no such table: employee_employee

[Any other relevant information, logs, error messages, or context that might help in understanding and fixing the issue.]

Possible Solution

[If you have any ideas or suggestions on how to fix the issue, feel free to provide them here. This is optional.]

Labels

[If your project uses labels, suggest any labels that might apply to this issue, such as 'bug', 'needs investigation', etc.]

Priority

[Specify the priority level for this issue, such as 'high', 'medium', 'low', etc.]

Assignees

[If you want to suggest an assignee or tag a specific person to look into this issue, mention their GitHub username here.]

Related Issues

[If there are any related issues or pull requests, mention them here. This is optional.]

Note: Remember to search through existing issues before submitting a new one to ensure that the issue hasn't been reported already. Provide as much information as possible to help the maintainers understand and address the problem effectively.

@Najeeb-joya
Copy link

Najeeb-joya commented Jan 9, 2025

@christabeladdo Hi I have the same issue on ubuntu server 24 LTS when i run the migration command

horilla

@horilla-opensource
Copy link
Owner

Hi @christabeladdo,

Thanks for reporting this issue!

We’ve identified the root cause and fixed the source code.
The fix has been merged into the master branch.

Please pull the latest changes and try running python manage.py makemigrations again.

If the issue persists, let us know, and we’ll investigate further.

With Regards,
Team Horilla

@christabeladdo
Copy link
Author

christabeladdo commented Jan 10, 2025

Thanks for getting back to me Team.

The error has changed to

"No module named 'pdfkit'". There is a syntax error too.

A copy of the errors are pasted below

C:\Users\Head of IT\horilla>python manage.py makemigrations
C:\Users\Head of IT\horilla\horilla_views\templatetags\generic_template_filters.py:24: SyntaxWarning: invalid escape sequence '\d'
numeric_test = re.compile("^\d+$")
Traceback (most recent call last):
File "C:\Users\Head of IT\horilla\manage.py", line 22, in
main()
File "C:\Users\Head of IT\horilla\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management_init_.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management_init_.py", line 416, in execute
django.setup()
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django_init_.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\apps\registry.py", line 124, in populate
app_config.ready()
File "C:\Users\Head of IT\horilla\recruitment\apps.py", line 26, in ready
from horilla.urls import urlpatterns
File "C:\Users\Head of IT\horilla\horilla\urls.py", line 44, in
path("api/", include("horilla_api.urls")),
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\importlib_init_.py", line 90, in import_module
return _bootstrap.gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\horilla\horilla_api\urls.py", line 9, in
path("payroll/", include("horilla_api.api_urls.payroll.urls")),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\urls\conf.py", line 38, in include
urlconf_module = import_module(urlconf_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\importlib_init
.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\horilla\horilla_api\api_urls\payroll\urls.py", line 3, in
from ...api_views.payroll.views import *
File "C:\Users\Head of IT\horilla\horilla_api\api_views\payroll\views.py", line 29, in
from payroll.threadings.mail import MailSendThread
File "C:\Users\Head of IT\horilla\payroll\threadings\mail.py", line 16, in
from payroll.views.views import payslip_pdf
File "C:\Users\Head of IT\horilla\payroll\views\views.py", line 14, in
import pdfkit
ModuleNotFoundError: No module named 'pdfkit'

@horilla-opensource
Copy link
Owner

Hi @Najeeb-joya ,

Please run pip install pdfkit

There has been a new addition to the requirements list of Horilla. Please install pdfkit package also.

With Regards,
Team Horilla

@christabeladdo
Copy link
Author

Thanks team. Now i have moved to "python manage.py migrate"and the error coming up is

django.db.utils.OperationalError: table "accessibility_defaultaccessibility_employees" already exists.

I have pasted the full error below. Can you kindly help again?

C:\Users\Head of IT\horilla>python manage.py migrate
Operations to perform:
Apply all migrations: accessibility, admin, asset, attendance, auditlog, auth, base, biometric, contenttypes, django_apscheduler, employee, helpdesk, horilla_audit, horilla_automations, horilla_documents, horilla_views, leave, notifications, offboarding, onboarding, payroll, pms, recruitment, sessions
Running migrations:
Applying accessibility.0002_initial...Traceback (most recent call last):
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 87, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\sqlite3\base.py", line 324, in execute
return super().execute(query)
^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: table "accessibility_defaultaccessibility_employees" already exists

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\Head of IT\horilla\manage.py", line 22, in
main()
File "C:\Users\Head of IT\horilla\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management_init_.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management_init_.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\base.py", line 458, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\core\management\commands\migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\migrations\executor.py", line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\migrations\executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\migrations\executor.py", line 252, in apply_migration
state = migration.apply(state, schema_editor)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\migrations\migration.py", line 132, in apply
operation.database_forwards(
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\migrations\operations\fields.py", line 108, in database_forwards
schema_editor.add_field(
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\sqlite3\schema.py", line 387, in add_field
self.create_model(field.remote_field.through)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\base\schema.py", line 451, in create_model
self.execute(sql, params or None)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\base\schema.py", line 201, in execute
cursor.execute(sql, params)
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 102, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 84, in _execute
with self.db.wrap_database_errors:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\utils.py", line 87, in _execute
return self.cursor.execute(sql)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Head of IT\AppData\Local\Programs\Python\Python312\Lib\site-packages\django\db\backends\sqlite3\base.py", line 324, in execute
return super().execute(query)
^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: table "accessibility_defaultaccessibility_employees" already exists

@christabeladdo
Copy link
Author

It was fixed after the test DB was removed. Thanks so much for the support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants