horilla-opensource / horilla

Horilla is a free and open source HR software.
https://www.horilla.com/
GNU Lesser General Public License v2.1
233 stars 154 forks source link

Not creating horilla user #86

Closed Sathyajoe closed 9 months ago

Sathyajoe commented 9 months ago

Bug Report

Find the attached log for reference, OS Version : Ubuntu 22.04.3 LTS

Command : python3 manage.py createhorillauser Enter first name: Test2 Enter last name: User2 Enter username: admin2 Enter password: admin2 Enter email: Enter phone number: Traceback (most recent call last): File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) sqlite3.OperationalError: no such table: employee_bonuspoint

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

Traceback (most recent call last): File "/home/sathya/Downloads/horilla-install-ubuntu.sh/horilla/base/management/commands/createhorillauser.py", line 47, in handle employee.save() File "/home/sathya/Downloads/horilla-install-ubuntu.sh/horilla/employee/models.py", line 358, in save super().save(*args, kwargs) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/base.py", line 814, in save self.save_base( File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/base.py", line 892, in save_base post_save.send( File "/home/sathya/.local/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 176, in send return [ File "/home/sathya/.local/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 177, in (receiver, receiver(signal=self, sender=sender, named)) File "/home/sathya/Downloads/horilla-install-ubuntu.sh/horilla/employee/models.py", line 677, in bonus_post_save if not BonusPoint.objects.filter(employee_id__id=instance.id).exists(): File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/query.py", line 1241, in exists return self.query.has_results(using=self.db) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/sql/query.py", line 598, in has_results return compiler.has_results() File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1530, in has_results return bool(self.execute_sql(SINGLE)) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql cursor.execute(sql, params) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 102, in execute return super().execute(sql, params) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers( File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers return executor(sql, params, many, context) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute with self.db.wrap_database_errors: File "/home/sathya/.local/lib/python3.10/site-packages/django/db/utils.py", line 91, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) File "/home/sathya/.local/lib/python3.10/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_bonuspoint

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) sqlite3.OperationalError: no such column: base_rotatingworktypeassign.created_at

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

Traceback (most recent call last): File "/home/sathya/Downloads/horilla-install-ubuntu.sh/horilla/manage.py", line 22, in main() File "/home/sathya/Downloads/horilla-install-ubuntu.sh/horilla/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/home/sathya/.local/lib/python3.10/site-packages/django/core/management/init.py", line 442, in execute_from_command_line utility.execute() File "/home/sathya/.local/lib/python3.10/site-packages/django/core/management/init.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/sathya/.local/lib/python3.10/site-packages/django/core/management/base.py", line 412, in run_from_argv self.execute(*args, *cmd_options) File "/home/sathya/.local/lib/python3.10/site-packages/django/core/management/base.py", line 458, in execute output = self.handle(args, **options) File "/home/sathya/Downloads/horilla-install-ubuntu.sh/horilla/base/management/commands/createhorillauser.py", line 59, in handle user.delete() File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/base.py", line 1131, in delete collector.collect([self], keep_parents=keep_parents) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/deletion.py", line 350, in collect on_delete(self, field, sub_objs, self.using) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/deletion.py", line 23, in CASCADE collector.collect( File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/deletion.py", line 348, in collect if getattr(on_delete, "lazy_sub_objs", False) or sub_objs: File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/query.py", line 412, in bool self._fetch_all() File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/query.py", line 1881, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/query.py", line 91, in iter results = compiler.execute_sql( File "/home/sathya/.local/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql cursor.execute(sql, params) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 102, in execute return super().execute(sql, params) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers( File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers return executor(sql, params, many, context) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute with self.db.wrap_database_errors: File "/home/sathya/.local/lib/python3.10/site-packages/django/db/utils.py", line 91, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) File "/home/sathya/.local/lib/python3.10/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute return super().execute(query, params) django.db.utils.OperationalError: no such column: base_rotatingworktypeassign.created_at

Sathyajoe commented 9 months ago

Tried with latest repo pulled on 15th Feb'24 at 11AM.

horilla-opensource commented 9 months ago

Hi @Sathyajoe , Did you run the migration commands? python manage.py makemigrations python manage.py migrate

With Regards, Team Horilla

Sathyajoe commented 9 months ago

Yes, both are worked fine without an issue, successfully completed the process of migrations & migrate.

Log FYI : $ sudo python3 manage.py makemigrations [sudo] password for sathya: No changes detected sathya@Ubuntu:~/Downloads/horilla-install-ubuntu.sh/horilla$ sudo python3 manage.py migrate Operations to perform: Apply all migrations: admin, asset, attendance, auth, base, contenttypes, django_apscheduler, employee, helpdesk, horilla_audit, horilla_documents, leave, notifications, offboarding, onboarding, payroll, pms, recruitment, sessions Running migrations: No migrations to apply.

horilla-opensource commented 9 months ago

Are you working with the test database provided or a new blank database?

Sathyajoe commented 9 months ago

Currently using new blank dayabase

horilla-opensource commented 9 months ago

Okay. So can try by removing all the existing migration files and running the makemigrations and migrate command again.

Sathyajoe commented 9 months ago

I've cleared migrations & retried still the issue is same. used following commands to clear the migrations :

  1. find . -path "/migrations/.py" -not -name "init.py" -delete^C
  2. find . -path "/migrations/.pyc" -delete
horilla-opensource commented 9 months ago

Can you make sure that this commands remove the migrations files in all the apps, as this is not working for me?

I've cleared migrations & retried still the issue is same. used following commands to clear the migrations :

1. find . -path "_/migrations/_.py" -not -name "**init**.py" -delete^C

2. find . -path "_/migrations/_.pyc"  -delete
horilla-opensource commented 9 months ago

Try these command and check. find . -path "*/migrations/*.py" -not -name "__init__.py" -delete

Sathyajoe commented 9 months ago

No luck !! tried to configure in windows 11 as well, getting same error !!

horilla-opensource commented 9 months ago

Sorry for the inconvenience caused. Can we start from the scratch? Please use the following steps and try the installation again.

  1. Create a new directory and initialize git inside it using git init command.
  2. Pull the code from the git repo using the command git pull https://github.com/horilla-opensource/horilla.git master
  3. Install the requirements using the command pip install -r requirements.txt .
  4. Remove the test database from the git directory or change the name of the database in the horilla/settings.py file.
  5. Additionally run the command mentioned above to remove the migrations files (if any) find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
  6. Run the makemigrations and migrate command to setup the database.

Please let us know if this works, or else we can arrange a meeting with our team to assist you with the installation.

With Regards, Team Horilla

Sathyajoe commented 9 months ago

Awesome, its working pretty well.

Thanks a lot team for your constant support since morning.

horilla-opensource commented 9 months ago

Thanks, Happy to hear that. Do let us know if you face any concerns. We are closing this issue as it is resolved.

With Regards, Team Horilla