Skip to content

Commit 49af00b

Browse files
committed
fix recreate table issue
1 parent 3657d2f commit 49af00b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

44_data_processing/examples/user.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ impl UserDb {
7070

7171
/// 重新创建 users 表
7272
async fn recreate_table(pool: &SqlitePool) -> Result<()> {
73-
sqlx::query("DROP TABLE users").execute(pool).await?;
73+
sqlx::query("DROP TABLE IF EXISTS users")
74+
.execute(pool)
75+
.await?;
7476
sqlx::query(
7577
r#"CREATE TABLE IF NOT EXISTS users(
7678
id INTEGER PRIMARY KEY NOT NULL,

0 commit comments

Comments
 (0)