Backup Room database

后端 未结 7 797
夕颜
夕颜 2020-12-08 01:41

I\'m trying to backup a room database programmatically.

For that, I\'m simply copying the .sqlite file that contains the whole database

But, bef

7条回答
  •  执笔经年
    2020-12-08 02:09

    As an alternative, you can always create your Room database while forcing it not to use write ahead logging:

    Room.databaseBuilder(context, db.class, dbName)
        .setJournalMode(JournalMode.TRUNCATE)
        .build();
    

提交回复
热议问题