Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix seed data so repo path and repo name are correct #2318

Merged
merged 1 commit into from
Apr 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql import text
import re
from augur.application.db.models import Repo


# revision identifiers, used by Alembic.
Expand All @@ -26,12 +27,13 @@ def upgrade():
if result:

for row in result:
regex = re.search(r"https:\/\/(github\.com\/[A-Za-z0-9 \- _]+\/)([A-Za-z0-9 \- _ .]+)$", row.repo_git)
if not regex:

owner_name, repo_name = Repo.parse_github_repo_url(row.repo_git)
if not owner_name or not repo_name:
continue
repo_path = regex[0]
repo_name = regex[1]

repo_path = f"github.com/{owner_name}/"

conn.execute(text(f"""
UPDATE "repo"
SET repo_path=:path,repo_name=:name
Expand Down