|
5 | 5 | Create Date: 2025-03-03 17:34:37.242326
|
6 | 6 |
|
7 | 7 | """
|
8 |
| -from alembic import op |
9 |
| -import sqlalchemy as sa |
10 | 8 |
|
| 9 | +import sqlalchemy as sa |
| 10 | +from alembic import op |
11 | 11 |
|
12 | 12 | # revision identifiers, used by Alembic.
|
13 |
| -revision = 'b2a0463d9b91' |
14 |
| -down_revision = 'e0fcdc14251c' |
| 13 | +revision = "b2a0463d9b91" |
| 14 | +down_revision = "e0fcdc14251c" |
15 | 15 | branch_labels = None
|
16 | 16 | depends_on = None
|
17 | 17 |
|
18 | 18 |
|
19 | 19 | def upgrade():
|
20 | 20 | # ### commands auto generated by Alembic - please adjust! ###
|
21 |
| - op.create_table('codegen_unit_test_generation_pr_context_to_run_id', |
22 |
| - sa.Column('id', sa.Integer(), nullable=False), |
23 |
| - sa.Column('provider', sa.String(), nullable=False), |
24 |
| - sa.Column('owner', sa.String(), nullable=False), |
25 |
| - sa.Column('pr_id', sa.BigInteger(), nullable=False), |
26 |
| - sa.Column('repo', sa.String(), nullable=False), |
27 |
| - sa.Column('run_id', sa.Integer(), nullable=False), |
28 |
| - sa.Column('iterations', sa.Integer(), nullable=False), |
29 |
| - sa.Column('original_pr_url', sa.String(), nullable=False), |
30 |
| - sa.ForeignKeyConstraint(['run_id'], ['run_state.id'], ondelete='CASCADE'), |
31 |
| - sa.PrimaryKeyConstraint('id'), |
32 |
| - sa.UniqueConstraint('provider', 'pr_id', 'repo', 'owner', 'original_pr_url') |
| 21 | + op.create_table( |
| 22 | + "codegen_unit_test_generation_pr_context_to_run_id", |
| 23 | + sa.Column("id", sa.Integer(), nullable=False), |
| 24 | + sa.Column("provider", sa.String(), nullable=False), |
| 25 | + sa.Column("owner", sa.String(), nullable=False), |
| 26 | + sa.Column("pr_id", sa.BigInteger(), nullable=False), |
| 27 | + sa.Column("repo", sa.String(), nullable=False), |
| 28 | + sa.Column("run_id", sa.Integer(), nullable=False), |
| 29 | + sa.Column("iterations", sa.Integer(), nullable=False), |
| 30 | + sa.Column("original_pr_url", sa.String(), nullable=False), |
| 31 | + sa.ForeignKeyConstraint(["run_id"], ["run_state.id"], ondelete="CASCADE"), |
| 32 | + sa.PrimaryKeyConstraint("id"), |
| 33 | + sa.UniqueConstraint("provider", "pr_id", "repo", "owner", "original_pr_url"), |
33 | 34 | )
|
34 |
| - with op.batch_alter_table('codegen_unit_test_generation_pr_context_to_run_id', schema=None) as batch_op: |
35 |
| - batch_op.create_index('ix_autofix_repo_owner_pr_id', ['owner', 'repo', 'pr_id', 'original_pr_url'], unique=False) |
| 35 | + with op.batch_alter_table( |
| 36 | + "codegen_unit_test_generation_pr_context_to_run_id", schema=None |
| 37 | + ) as batch_op: |
| 38 | + batch_op.create_index( |
| 39 | + "ix_autofix_repo_owner_pr_id", |
| 40 | + ["owner", "repo", "pr_id", "original_pr_url"], |
| 41 | + unique=False, |
| 42 | + ) |
36 | 43 |
|
37 | 44 | # ### end Alembic commands ###
|
38 | 45 |
|
39 | 46 |
|
40 | 47 | def downgrade():
|
41 | 48 | # ### commands auto generated by Alembic - please adjust! ###
|
42 |
| - with op.batch_alter_table('codegen_unit_test_generation_pr_context_to_run_id', schema=None) as batch_op: |
43 |
| - batch_op.drop_index('ix_autofix_repo_owner_pr_id') |
| 49 | + with op.batch_alter_table( |
| 50 | + "codegen_unit_test_generation_pr_context_to_run_id", schema=None |
| 51 | + ) as batch_op: |
| 52 | + batch_op.drop_index("ix_autofix_repo_owner_pr_id") |
44 | 53 |
|
45 |
| - op.drop_table('codegen_unit_test_generation_pr_context_to_run_id') |
| 54 | + op.drop_table("codegen_unit_test_generation_pr_context_to_run_id") |
46 | 55 | # ### end Alembic commands ###
|
0 commit comments