From 3d40ec513e0b9595f8e1c32da93b3e6968cde243 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Wed, 6 Mar 2024 08:03:03 +0100 Subject: [PATCH] Adding a bunch of dummy comments on each post --- server/src/state.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/src/state.rs b/server/src/state.rs index 1a363db..c4748c2 100644 --- a/server/src/state.rs +++ b/server/src/state.rs @@ -105,6 +105,19 @@ async fn lipsum_setup(pool: &PgPool) -> Result<(), sqlx::Error> { .execute(pool) .await?; } + + // Insert a bunch of comments + for i in 1..101 { + for _ in 0..rng.gen_range(3..30) { + query!( + "INSERT INTO comments (author_user_id, parent_post_id, content) VALUES (1, $1, $2)", + i, + lipsum(rng.gen_range(10..100)) + ) + .execute(pool) + .await?; + } + } } Ok(())