Skip to content

Commit

Permalink
Merge pull request #16 from kudos-ink/allow-import-rerun
Browse files Browse the repository at this point in the history
refactor: delete preexisting project before starting importing
  • Loading branch information
CJ13th authored Sep 25, 2024
2 parents 2f77a80 + da2f098 commit b82be18
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 b82be18

Please sign in to comment.