/** * From one Loro database per document to one library, once, on the first start that finds the * older layout and no library: * * /docs//.loro the per-document layout * /.loro the single-document layout before it (the first document) * * Every document's main branch is imported into one new Loro database, histories and all: each * document's ops keep their ids, so its notes stay anchored, its open conflicts stay open, and * every commit it ever made can still be checked out and verified (a checkout from before the * library shows that document alone, as it stood). One commit then makes the Library root and * moves each document's root under it, in order. A document that shares * history with one already imported (a duplicate, which began as a byte copy) cannot be imported * beside it without merging into it, so it is copied in as content instead. * * The library is written to a temporary directory and renamed into place; only then is the old * `docs` directory renamed to `docs.migrated-