max / makenotwork
1 file changed,
+2 insertions,
-1 deletion
| @@ -200,6 +200,7 @@ const MIGRATIONS: &[(i64, &str, &str)] = &[ | |||
| 200 | 200 | pub async fn connect(path: &Path) -> Result<SqlitePool> { | |
| 201 | 201 | let opts = SqliteConnectOptions::from_str(&format!("sqlite:{}", path.display()))? | |
| 202 | 202 | .create_if_missing(true) | |
| 203 | + | .foreign_keys(true) | |
| 203 | 204 | .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal); | |
| 204 | 205 | ||
| 205 | 206 | let pool = SqlitePoolOptions::new() | |
| @@ -213,7 +214,7 @@ pub async fn connect(path: &Path) -> Result<SqlitePool> { | |||
| 213 | 214 | ||
| 214 | 215 | #[instrument(skip_all)] | |
| 215 | 216 | pub async fn connect_in_memory() -> Result<SqlitePool> { | |
| 216 | - | let opts = SqliteConnectOptions::from_str("sqlite::memory:")?; | |
| 217 | + | let opts = SqliteConnectOptions::from_str("sqlite::memory:")?.foreign_keys(true); | |
| 217 | 218 | let pool = SqlitePoolOptions::new() | |
| 218 | 219 | .max_connections(1) | |
| 219 | 220 | .connect_with(opts) |