Skip to content

Commit b233ec0

Browse files
More robust migration file for unittest context; format
1 parent df3c1e1 commit b233ec0

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

docassemble/GithubFeedbackForm/alembic/versions/5b46c3a6f9b7_add_github_user_and_repo.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,36 @@
55
Create Date: 2025-07-31 10:00:00.000000
66
77
"""
8+
89
from alembic import op
910
import sqlalchemy as sa
1011

1112

1213
# revision identifiers, used by Alembic.
13-
revision = '5b46c3a6f9b7'
14-
down_revision = '8821926028d6'
14+
revision = "5b46c3a6f9b7"
15+
down_revision = "8821926028d6"
1516
branch_labels = None
1617
depends_on = None
1718

1819

20+
from sqlalchemy.inspection import inspect
21+
22+
1923
def upgrade():
20-
op.add_column('feedback_session', sa.Column('github_user', sa.String(), nullable=True))
21-
op.add_column('feedback_session', sa.Column('github_repo_name', sa.String(), nullable=True))
24+
inspector = inspect(op.get_bind())
25+
columns = [col.name for col in inspector.get_columns("feedback_session")]
26+
27+
if "github_user" not in columns:
28+
op.add_column(
29+
"feedback_session", sa.Column("github_user", sa.String(), nullable=True)
30+
)
31+
if "github_repo_name" not in columns:
32+
op.add_column(
33+
"feedback_session",
34+
sa.Column("github_repo_name", sa.String(), nullable=True),
35+
)
2236

2337

2438
def downgrade():
25-
op.drop_column('feedback_session', 'github_user')
26-
op.drop_column('feedback_session', 'github_repo_name')
39+
op.drop_column("feedback_session", "github_user")
40+
op.drop_column("feedback_session", "github_repo_name")

docassemble/GithubFeedbackForm/github_issue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def prefill_github_issue_url(
348348
payload = {"title": title, "body": body}
349349
url_params = urlencode(payload, quote_via=quote_plus)
350350

351-
return f"https://github.com/{repo_owner}/{repo_name}/issues/new?{url_params}"
351+
return f"https://github.com/{repo_owner}/{repo_name}/issues/new?{url_params}"
352352

353353

354354
def make_github_issue(

0 commit comments

Comments
 (0)