Browse Source

perf(database): use `TRUNCATE` instead of `DELETE FROM` in migrations

This is marginally faster.
jvoisin 9 months ago
parent
commit
ef3dbd3707
1 changed files with 1 additions and 1 deletions
  1. 1 1
      internal/database/database.go

+ 1 - 1
internal/database/database.go

@@ -34,7 +34,7 @@ func Migrate(db *sql.DB) error {
 			return fmt.Errorf("[Migration v%d] %v", newVersion, err)
 		}
 
-		if _, err := tx.Exec(`DELETE FROM schema_version`); err != nil {
+		if _, err := tx.Exec(`TRUNCATE schema_version`); err != nil {
 			tx.Rollback()
 			return fmt.Errorf("[Migration v%d] %v", newVersion, err)
 		}