Skip to content

Alembic migration conflict: add_sso_login_enabled creates multi-head and fails with duplicate column #226

@Congregalis

Description

@Congregalis

Deployment Method

Source

Summary

After pulling latest code and running:

cd backend
source .venv/bin/activate
alembic upgrade head

migration fails with:

  • Multiple head revisions are present for given argument 'head'
  • If using alembic upgrade heads, then:
    DuplicateColumnError: column "sso_login_enabled" of relation "identity_providers" already exists

Related Commit: dd7763c
Related File: add_sso_login_enabled.py

Cause

  1. backend/alembic/versions/add_sso_login_enabled.py has:
  • revision = "add_sso_login_enabled"
  • down_revision = None
    This introduces a new root branch and causes multiple heads.
  1. Runtime schema can already contain sso_login_enabled before this migration runs because:
  • ORM model includes sso_login_enabled in IdentityProvider
  • App startup scripts call Base.metadata.create_all:
    If identity_providers is created from ORM metadata first, migration op.add_column(...) becomes duplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions