Unable to apply migrations #35

Closed
opened 2021-10-12 20:56:52 +02:00 by debdolph · 11 comments
debdolph commented 2021-10-12 20:56:52 +02:00 (Migrated from edugit.org)
Running migrations:
  Applying ldap.0001_preferences...Traceback (most recent call last):
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/query.py", line 581, in get_or_create
    return self.get(**kwargs), False
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/query.py", line 435, in get
    raise self.model.DoesNotExist(
__fake__.DoesNotExist: SitePreferenceModel matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/www/aleksis/venv/bin/aleksis-admin", line 8, in <module>
    sys.exit(aleksis_cmd())
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/aleksis/core/__main__.py", line 14, in aleksis_cmd
    execute_from_command_line(sys.argv)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/base.py", line 89, in wrapped
    res = handle_func(*args, **kwargs)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 244, in handle
    post_migrate_state = executor.migrate(
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/migrations/executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/migrations/migration.py", line 126, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/migrations/operations/special.py", line 190, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/aleksis/apps/ldap/migrations/0001_preferences.py", line 28, in _migrate_preferences
    SitePreferenceModel.objects.update_or_create(
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/query.py", line 608, in update_or_create
    obj, created = self.select_for_update().get_or_create(defaults, **kwargs)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/query.py", line 588, in get_or_create
    return self.create(**params), True
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/query.py", line 451, in create
    obj = self.model(**kwargs)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/base.py", line 485, in __init__
    _setattr(self, field.name, rel_obj)
  File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 215, in __set__
    raise ValueError(
ValueError: Cannot assign "1": "SitePreferenceModel.instance" must be a "Site" instance.
``` Running migrations: Applying ldap.0001_preferences...Traceback (most recent call last): File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/query.py", line 581, in get_or_create return self.get(**kwargs), False File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/query.py", line 435, in get raise self.model.DoesNotExist( __fake__.DoesNotExist: SitePreferenceModel matching query does not exist. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/srv/www/aleksis/venv/bin/aleksis-admin", line 8, in <module> sys.exit(aleksis_cmd()) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/aleksis/core/__main__.py", line 14, in aleksis_cmd execute_from_command_line(sys.argv) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line utility.execute() File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, **cmd_options) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(*args, **options) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/base.py", line 89, in wrapped res = handle_func(*args, **kwargs) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 244, in handle post_migrate_state = executor.migrate( File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/migrations/executor.py", line 227, in apply_migration state = migration.apply(state, schema_editor) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/migrations/migration.py", line 126, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/migrations/operations/special.py", line 190, in database_forwards self.code(from_state.apps, schema_editor) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/aleksis/apps/ldap/migrations/0001_preferences.py", line 28, in _migrate_preferences SitePreferenceModel.objects.update_or_create( File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/query.py", line 608, in update_or_create obj, created = self.select_for_update().get_or_create(defaults, **kwargs) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/query.py", line 588, in get_or_create return self.create(**params), True File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/query.py", line 451, in create obj = self.model(**kwargs) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/base.py", line 485, in __init__ _setattr(self, field.name, rel_obj) File "/srv/www/aleksis/venv/lib/python3.9/site-packages/django/db/models/fields/related_descriptors.py", line 215, in __set__ raise ValueError( ValueError: Cannot assign "1": "SitePreferenceModel.instance" must be a "Site" instance. ```
hansegucker commented 2021-11-02 20:32:41 +01:00 (Migrated from edugit.org)

assigned to @hansegucker

assigned to @hansegucker
hansegucker commented 2021-11-02 20:33:22 +01:00 (Migrated from edugit.org)

unassigned @hansegucker

unassigned @hansegucker
nik commented 2021-11-29 15:19:23 +01:00 (Migrated from edugit.org)

Thisis entirely reproducible, e.g. by using the official docker-compose setup.

Thisis entirely reproducible, e.g. by using the official `docker-compose` setup.
nik commented 2021-11-29 15:25:58 +01:00 (Migrated from edugit.org)

created merge request !143 to address this issue

created merge request !143 to address this issue
nik commented 2021-11-29 15:25:58 +01:00 (Migrated from edugit.org)

mentioned in merge request !143

mentioned in merge request !143
nik commented 2021-11-29 15:35:32 +01:00 (Migrated from edugit.org)

assigned to @nik

assigned to @nik
hansegucker (Migrated from edugit.org) closed this issue 2021-11-29 18:26:56 +01:00
hansegucker commented 2021-11-29 18:26:57 +01:00 (Migrated from edugit.org)

mentioned in commit dce699b1d2

mentioned in commit dce699b1d2a7c22b6c4a04c186f76f86d4b55249
nik (Migrated from edugit.org) reopened this issue 2021-11-30 01:13:45 +01:00
nik commented 2021-11-30 01:14:01 +01:00 (Migrated from edugit.org)

Still broken.

Still broken.
nik commented 2021-11-30 01:18:01 +01:00 (Migrated from edugit.org)
  File "/usr/local/lib/python3.9/dist-packages/aleksis/apps/ldap/migrations/0001_preferences.py", line 30, in _migrate_preferences
    qs = SitePreferenceModel.objects.filter(instance=current_site, section="ldap", name=old_pref_name)
  File "/usr/local/lib/python3.9/dist-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 941, in filter
    return self._filter_or_exclude(False, args, kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 961, in _filter_or_exclude
    clone._filter_or_exclude_inplace(negate, args, kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 968, in _filter_or_exclude_inplace
    self._query.add_q(Q(*args, **kwargs))
  File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/query.py", line 1393, in add_q
    clause, _ = self._add_q(q_object, self.used_aliases)
  File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/query.py", line 1412, in _add_q
    child_clause, needed_inner = self.build_filter(
  File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/query.py", line 1320, in build_filter
    self.check_related_objects(join_info.final_field, value, join_info.opts)
  File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/query.py", line 1147, in check_related_objects
    self.check_query_object_type(value, opts, field)
  File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/query.py", line 1128, in check_query_object_type
    raise ValueError(
ValueError: Cannot query "sis.leopard.institute": Must be "Site" instance.
```plain File "/usr/local/lib/python3.9/dist-packages/aleksis/apps/ldap/migrations/0001_preferences.py", line 30, in _migrate_preferences qs = SitePreferenceModel.objects.filter(instance=current_site, section="ldap", name=old_pref_name) File "/usr/local/lib/python3.9/dist-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 941, in filter return self._filter_or_exclude(False, args, kwargs) File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 961, in _filter_or_exclude clone._filter_or_exclude_inplace(negate, args, kwargs) File "/usr/local/lib/python3.9/dist-packages/django/db/models/query.py", line 968, in _filter_or_exclude_inplace self._query.add_q(Q(*args, **kwargs)) File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/query.py", line 1393, in add_q clause, _ = self._add_q(q_object, self.used_aliases) File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/query.py", line 1412, in _add_q child_clause, needed_inner = self.build_filter( File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/query.py", line 1320, in build_filter self.check_related_objects(join_info.final_field, value, join_info.opts) File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/query.py", line 1147, in check_related_objects self.check_query_object_type(value, opts, field) File "/usr/local/lib/python3.9/dist-packages/django/db/models/sql/query.py", line 1128, in check_query_object_type raise ValueError( ValueError: Cannot query "sis.leopard.institute": Must be "Site" instance. ```
nik commented 2021-12-01 23:41:11 +01:00 (Migrated from edugit.org)

mentioned in merge request !148

mentioned in merge request !148
hansegucker (Migrated from edugit.org) closed this issue 2021-12-02 15:15:58 +01:00
hansegucker commented 2021-12-02 15:15:59 +01:00 (Migrated from edugit.org)

mentioned in commit 4a8fe77dfb

mentioned in commit 4a8fe77dfbefb5c356d5f0ce4ba372fa24d7f248
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aleksis/AlekSIS-App-LDAP#35
No description provided.