diff --git a/src/NexusMods.MnemonicDB/Connection.cs b/src/NexusMods.MnemonicDB/Connection.cs index 7e9ab7f3..957cf011 100644 --- a/src/NexusMods.MnemonicDB/Connection.cs +++ b/src/NexusMods.MnemonicDB/Connection.cs @@ -48,7 +48,7 @@ public class Connection : IConnection /// /// Main connection class, co-ordinates writes and immutable reads /// - public Connection(ILogger logger, IDatomStore store, IServiceProvider provider, IEnumerable analyzers) + public Connection(ILogger logger, IDatomStore store, IServiceProvider provider, IEnumerable analyzers, bool readOnlyMode = false) { ServiceProvider = provider; AttributeCache = store.AttributeCache; @@ -57,7 +57,7 @@ public Connection(ILogger logger, IDatomStore store, IServiceProvide _store = (DatomStore)store; _dbStream = new DbStream(); _analyzers = analyzers.ToArray(); - Bootstrap(); + Bootstrap(readOnlyMode); } /// @@ -315,7 +315,7 @@ internal async Task Transact(IInternalTxFunction fn) return result; } - private void Bootstrap() + private void Bootstrap(bool readOnlyMode) { try { @@ -327,7 +327,9 @@ private void Bootstrap() AttributeCache.Reset(initialDb); var declaredAttributes = AttributeResolver.DefinedAttributes.OrderBy(a => a.Id.Id).ToArray(); - _store.Transact(new SimpleMigration(declaredAttributes)); + + if (!readOnlyMode) + _store.Transact(new SimpleMigration(declaredAttributes)); _dbStreamDisposable = ProcessUpdates(_store.TxLog) .Subscribe();