Skip to content

Self-hosted 25.7.7 / 25.8.5 codecov-api fails to boot with migration #64

@kwonoj

Description

@kwonoj

Describe the bug
Was on the 25.6.2, tried to upgrade to 25.7.7 or the latest 25.8.5 and seeing the logs as below, with failing to boot the app.

Starting api
Running migrations

==> Checking License
    License is valid
    License expires 2030-12-25 00:00:00 <==

{"message": "Codecov is starting migrations...", "asctime": "2025-07-18 17:47:34,708", "name": "shared.django_apps.legacy_migrations.management.commands.migrate", "levelname": "INFO", "lineno": 117, "pathname": "/usr/local/lib/python3.13/site-packages/shared/django_apps/legacy_migrations/management/commands/migrate.py", "funcName": "handle", "threadName": "MainThread", "utctime": "2025-07-18T17:47:34.708000", "logger.name": "shared.django_apps.legacy_migrations.management.commands.migrate", "logger.thread_name": "MainThread", "level": "INFO"}
{"message": "Trying to acquire migrations lock...", "asctime": "2025-07-18 17:47:34,709", "name": "shared.django_apps.legacy_migrations.management.commands.migrate", "levelname": "INFO", "lineno": 108, "pathname": "/usr/local/lib/python3.13/site-packages/shared/django_apps/legacy_migrations/management/commands/migrate.py", "funcName": "_obtain_lock", "threadName": "MainThread", "utctime": "2025-07-18T17:47:34.709000", "logger.name": "shared.django_apps.legacy_migrations.management.commands.migrate", "logger.thread_name": "MainThread", "level": "INFO"}
{"message": "Acquired Lock('lock:djang-migrations-lock').", "asctime": "2025-07-18 17:47:34,715", "name": "redis_lock.acquire", "levelname": "INFO", "lineno": 236, "pathname": "/usr/local/lib/python3.13/site-packages/redis_lock/__init__.py", "funcName": "acquire", "threadName": "MainThread", "utctime": "2025-07-18T17:47:34.715000", "logger.name": "redis_lock.acquire", "logger.thread_name": "MainThread", "level": "INFO"}
System check identified some issues:

WARNINGS:
codecov_auth.Owner.username: (fields.W907) django.contrib.postgres.fields.CITextField is deprecated. Support for it (except in historical migrations) will be removed in Django 5.1.
	HINT: Use TextField(db_collation="…") with a case-insensitive non-deterministic collation instead.
codecov_auth.User.email: (fields.W907) django.contrib.postgres.fields.CITextField is deprecated. Support for it (except in historical migrations) will be removed in Django 5.1.
	HINT: Use TextField(db_collation="…") with a case-insensitive non-deterministic collation instead.
core.Repository.name: (fields.W907) django.contrib.postgres.fields.CITextField is deprecated. Support for it (except in historical migrations) will be removed in Django 5.1.
	HINT: Use TextField(db_collation="…") with a case-insensitive non-deterministic collation instead.
Operations to perform:
  Apply all migrations: admin, auth, billing, bundle_analysis, codecov_auth, codecov_metrics, compare, contenttypes, core, labelanalysis, legacy_migrations, reports, rollouts, sessions, staticanalysis, ta_timeseries, timeseries, upload_breadcrumbs, user_measurements
Running migrations:
  Applying core.0061_increment_version...{"message": "Codecov migrations failed for default: Constants matching query does not exist.", "asctime": "2025-07-18 17:47:39,013", "name": "shared.django_apps.legacy_migrations.management.commands.migrate", "levelname": "INFO", "lineno": 145, "pathname": "/usr/local/lib/python3.13/site-packages/shared/django_apps/legacy_migrations/management/commands/migrate.py", "funcName": "handle", "threadName": "MainThread", "utctime": "2025-07-18T17:47:39.013000", "logger.name": "shared.django_apps.legacy_migrations.management.commands.migrate", "logger.thread_name": "MainThread", "level": "INFO"}
Traceback (most recent call last):
  File "/app/apps/codecov-api/manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
    ~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/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.13/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.13/site-packages/shared/django_apps/legacy_migrations/management/commands/migrate.py", line 142, in handle
    super().handle(*args, **options)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/django/core/management/base.py", line 106, in wrapper
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.13/site-packages/django/core/management/commands/migrate.py", line 356, in handle
    post_migrate_state = executor.migrate(
        targets,
    ...<3 lines>...
        fake_initial=fake_initial,
    )
  File "/usr/local/lib/python3.13/site-packages/django/db/migrations/executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
        state, plan, full_plan, fake=fake, fake_initial=fake_initial
    )
  File "/usr/local/lib/python3.13/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
        state, migration, fake=fake, fake_initial=fake_initial
    )
  File "/usr/local/lib/python3.13/site-packages/django/db/migrations/executor.py", line 252, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.13/site-packages/django/db/migrations/migration.py", line 132, in apply
    operation.database_forwards(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self.app_label, schema_editor, old_state, project_state
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
    self.code(from_state.apps, schema_editor)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/shared/django_apps/core/migrations/0061_increment_version.py", line 8, in update_version
    version = Constants.objects.get(key="version")
  File "/usr/local/lib/python3.13/site-packages/django/db/models/manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/django/db/models/query.py", line 637, in get
    raise self.model.DoesNotExist(
        "%s matching query does not exist." % self.model._meta.object_name
    )
__fake__.Constants.DoesNotExist: Constants matching query does not exist.

Seems

__fake__.Constants.DoesNotExist: Constants matching query does not exist.

is the issue - any idea how to workaround those?

Sorry for creating dupe from #63, not sure which one's right place to report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions