toasty_driver_integration_suite/scenarios/document_optional_body_deferred.rs
1use crate::prelude::*;
2
3scenario! {
4 #![id(ID)]
5
6 #[derive(Debug, toasty::Model)]
7 struct Document {
8 #[key]
9 #[auto]
10 id: ID,
11
12 title: String,
13
14 // Newtype embed whose single field is deferred — the nullable head
15 // reuses that one (deferred) leaf column.
16 body: Option<Body>,
17 }
18
19 #[derive(Debug, toasty::Embed)]
20 struct Body(toasty::Deferred<String>);
21
22 async fn setup(test: &mut Test) -> toasty::Db {
23 test.setup_db(models!(Document)).await
24 }
25}