Debug builds now provides dummy posts
This commit is contained in:
parent
686afb979c
commit
6b81763259
4 changed files with 36 additions and 0 deletions
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "INSERT INTO posts (user_id, content) VALUES (1, $1)",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "a700af019c69280cb9a0d199cc59a751a0ce16ccf2d94950219505764cc176e9"
|
||||
}
|
11
server/Cargo.lock
generated
11
server/Cargo.lock
generated
|
@ -1228,6 +1228,16 @@ version = "0.4.11"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
|
||||
|
||||
[[package]]
|
||||
name = "lipsum"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c5e9ef2d2ad6fe67a59ace27c203c8d3a71d195532ee82e3bbe0d5f9a9ca541"
|
||||
dependencies = [
|
||||
"rand",
|
||||
"rand_chacha",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "local-channel"
|
||||
version = "0.1.5"
|
||||
|
@ -1839,6 +1849,7 @@ dependencies = [
|
|||
"dotenvy",
|
||||
"env_logger",
|
||||
"jsonwebtoken",
|
||||
"lipsum",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
@ -15,6 +15,7 @@ clap = { version = "4.4.5", features = ["derive"] }
|
|||
dotenvy = "0.15.7"
|
||||
env_logger = "0.10.0"
|
||||
jsonwebtoken = "8.3.0"
|
||||
lipsum = "0.9.0"
|
||||
log = "0.4.20"
|
||||
serde = { version = "1.0.188", features = ["derive"] }
|
||||
serde_json = "1.0.107"
|
||||
|
|
|
@ -61,6 +61,7 @@ impl ServerState {
|
|||
// Mostly useful for debugging new posts, as we need to satisfy foreign key constraints.
|
||||
#[cfg(debug_assertions)]
|
||||
async fn debug_setup(pool: &PgPool) -> Result<(), sqlx::Error> {
|
||||
use lipsum::lipsum;
|
||||
use sqlx::query;
|
||||
|
||||
use crate::db::db_new_user;
|
||||
|
@ -79,6 +80,15 @@ async fn debug_setup(pool: &PgPool) -> Result<(), sqlx::Error> {
|
|||
query!("INSERT INTO posts (user_id, content) VALUES (1, 'Hello world! The demo username is user and the password is pass.')",)
|
||||
.execute(pool)
|
||||
.await?;
|
||||
|
||||
for _ in 0..10 {
|
||||
query!(
|
||||
"INSERT INTO posts (user_id, content) VALUES (1, $1)",
|
||||
lipsum(50)
|
||||
)
|
||||
.execute(pool)
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue