feat(FN-011): add repository_connection alembic migration
Fusion-Task-Id: FN-011 Fusion-Task-Lineage: 4a9aca6f-9d91-43aa-8d2a-d59657c1541a
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
"""add repository_connection
|
||||
|
||||
Revision ID: 42a78fd41e23
|
||||
Revises: 6cfa61694d0a
|
||||
Create Date: 2026-05-14 08:19:37.912177
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '42a78fd41e23'
|
||||
down_revision: Union[str, Sequence[str], None] = '6cfa61694d0a'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('repository_connection',
|
||||
sa.Column('project_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('repository_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('provider_kind', sa.String(length=50), nullable=False),
|
||||
sa.Column('credential_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('connection_status', sa.String(length=50), nullable=False),
|
||||
sa.Column('default_branch', sa.String(length=100), nullable=True),
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
|
||||
sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
|
||||
sa.ForeignKeyConstraint(['repository_id'], ['repository.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_repository_connection_credential_id'), 'repository_connection', ['credential_id'], unique=False)
|
||||
op.create_index(op.f('ix_repository_connection_project_id'), 'repository_connection', ['project_id'], unique=False)
|
||||
op.create_index(op.f('ix_repository_connection_repository_id'), 'repository_connection', ['repository_id'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_repository_connection_repository_id'), table_name='repository_connection')
|
||||
op.drop_index(op.f('ix_repository_connection_project_id'), table_name='repository_connection')
|
||||
op.drop_index(op.f('ix_repository_connection_credential_id'), table_name='repository_connection')
|
||||
op.drop_table('repository_connection')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user