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

Migration 0056 is failing #2040

Closed
mdellweg opened this issue Nov 21, 2024 · 0 comments · Fixed by #2041
Closed

Migration 0056 is failing #2040

mdellweg opened this issue Nov 21, 2024 · 0 comments · Fixed by #2041

Comments

@mdellweg
Copy link
Member

mdellweg commented Nov 21, 2024

# pulpcore-manager migrate
Operations to perform:
  Apply all migrations: ansible, auth, certguard, container, contenttypes, core, deb, file, gem, maven, ostree, python, rpm, sessions
Running migrations:
  Applying ansible.0056_collectionversion_sha256...Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 87, in _execute
    return self.cursor.execute(sql)
  File "/usr/local/lib/python3.9/site-packages/psycopg/cursor.py", line 97, in execute
    raise ex.with_traceback(None)
psycopg.errors.UniqueViolation: could not create unique index "ansible_collectionversion_sha256_a4d120ab_uniq"
DETAIL:  Key (sha256)=() is duplicated.

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

Traceback (most recent call last):
  File "/usr/local/bin/pulpcore-manager", line 8, in <module>
    sys.exit(manage())
  File "/usr/local/lib/python3.9/site-packages/pulpcore/app/manage.py", line 11, in manage
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 356, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/migration.py", line 132, in apply
    operation.database_forwards(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/operations/models.py", line 659, in database_forwards
    alter_together(
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 563, in alter_unique_together
    self.execute(self._create_unique_sql(model, fields))
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/postgresql/schema.py", line 48, in execute
    return super().execute(sql, None)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 201, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 87, in _execute
    return self.cursor.execute(sql)
  File "/usr/local/lib/python3.9/site-packages/psycopg/cursor.py", line 97, in execute
    raise ex.with_traceback(None)
django.db.utils.IntegrityError: could not create unique index "ansible_collectionversion_sha256_a4d120ab_uniq"
DETAIL:  Key (sha256)=() is duplicated.

Originally posted by @netsandbox in #1052 (comment)

mdellweg added a commit to mdellweg/pulp_ansible that referenced this issue Nov 22, 2024
Having more than one collection version in the system prevents the
migration 0056 to run, because null as a value is not allowed to appear
more than once.

We need to clean this up very careful, becuase on some systems the
migration may have applied cleanly.

fixes pulp#2040
mdellweg added a commit to mdellweg/pulp_ansible that referenced this issue Nov 22, 2024
Having more than one collection version in the system prevents the
migration 0056 to run, because null as a value is not allowed to appear
more than once.

We need to clean this up very careful, becuase on some systems the
migration may have applied cleanly.

fixes pulp#2040
patchback bot pushed a commit that referenced this issue Nov 22, 2024
Having more than one collection version in the system prevents the
migration 0056 to run, because null as a value is not allowed to appear
more than once.

We need to clean this up very careful, becuase on some systems the
migration may have applied cleanly.

fixes #2040

(cherry picked from commit 15561b9)
mdellweg added a commit that referenced this issue Nov 22, 2024
Having more than one collection version in the system prevents the
migration 0056 to run, because null as a value is not allowed to appear
more than once.

We need to clean this up very careful, becuase on some systems the
migration may have applied cleanly.

fixes #2040

(cherry picked from commit 15561b9)
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

Successfully merging a pull request may close this issue.

1 participant