1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
auto_derived!(
    /// Document representing migration information
    pub struct MigrationInfo {
        /// Unique Id
        #[serde(rename = "_id")]
        pub id: i32,
        /// Current database revision
        pub revision: i32,
    }
);

#[cfg(test)]
mod tests {
    #[async_std::test]
    async fn migrate() {
        database_test!(|db| async move {
            // Initialise the database
            db.migrate_database().await.unwrap();

            // Migrate the existing database
            db.migrate_database().await.unwrap();
        });
    }
}