Data migrations with Ottoman


I’m looking for something akin to the mongoose data migrations package, except for Ottoman. Suppose I create this situation where I’ve added a new field to some documents, or changed the structure of existing documents. If I run the new models against the old schema in the DB, I’m going to get strange errors. So it seems the data needs to be migrated before ottoman with new models starts talking to the database.

I’m sure I’m not the only one who has this issue, but I’m not finding much online in terms of options for migrating documents created with ottoman. Before I head out to roll my own approach, I thought I should ask what other people are doing in this situation.

Like SQL databases it seems to me the preferable route for migration would just be to execute a few n1ql queries, and then be done with it. But is there a framework for supporting the process of defining a migration, running it “up” vs “down”, knowing which version of the database the migration applies to, and so on?