Skip to content

Commit

Permalink
refactor: delete preexisting project before starting importing
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ13th committed Sep 25, 2024
1 parent 6052674 commit da2f098
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/import/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ async fn function_handler(event: Request) -> Result<Response<Body>, Error> {

let mut tx: sqlx::Transaction<'_, sqlx::Postgres> = pool.begin().await?;

// allow the import to be completely rerun by removing all data
sqlx::query("DELETE FROM projects WHERE slug = $1")
.bind(&project.slug)
.execute(&mut *tx)
.await?;

let project_id = insert_project(&project, &mut tx).await?;

let total_issues_imported = import_repositories(
Expand Down

0 comments on commit da2f098

Please sign in to comment.