diff --git a/src/CosmoStore.CosmosDb/CosmosDb.fs b/src/CosmoStore.CosmosDb/CosmosDb.fs index e890051..22d1e31 100644 --- a/src/CosmoStore.CosmosDb/CosmosDb.fs +++ b/src/CosmoStore.CosmosDb/CosmosDb.fs @@ -17,7 +17,8 @@ type Configuration = { CollectionName : string ServiceEndpoint : Uri AuthKey : string - Throughput: int + Throughput : int + InitializeCollection : bool } with static member CreateDefault serviceEndpoint authKey = { @@ -26,4 +27,5 @@ with ServiceEndpoint = serviceEndpoint AuthKey = authKey Throughput = Throughput.min + InitializeCollection = true } diff --git a/src/CosmoStore.CosmosDb/EventStore.fs b/src/CosmoStore.CosmosDb/EventStore.fs index f636bdd..c66cc31 100644 --- a/src/CosmoStore.CosmosDb/EventStore.fs +++ b/src/CosmoStore.CosmosDb/EventStore.fs @@ -158,11 +158,12 @@ let getEventStore (configuration:Configuration) = let appendEventProcUri = UriFactory.CreateStoredProcedureUri(configuration.DatabaseName, configuration.CollectionName, appendEventProcName) let eventAppended = Event() - task { - do! createDatabase configuration.DatabaseName client - do! createCollection dbUri configuration client - do! createStoreProcedures eventsCollectionUri appendEventProcUri configuration.CollectionName client - } |> Async.AwaitTask |> Async.RunSynchronously + if configuration.InitializeCollection then + task { + do! createDatabase configuration.DatabaseName client + do! createCollection dbUri configuration client + do! createStoreProcedures eventsCollectionUri appendEventProcUri configuration.CollectionName client + } |> Async.AwaitTask |> Async.RunSynchronously { AppendEvent = fun stream pos event -> task { diff --git a/src/CosmoStore.CosmosDb/RELEASE_NOTES.md b/src/CosmoStore.CosmosDb/RELEASE_NOTES.md index d5381a0..0e4b215 100644 --- a/src/CosmoStore.CosmosDb/RELEASE_NOTES.md +++ b/src/CosmoStore.CosmosDb/RELEASE_NOTES.md @@ -1,3 +1,7 @@ +### 2.1.0 - May 17 2019 +* Configurable collection name #25 +* Configurable initialization #23 + ### 2.0.1 - February 12 2019 * Fixing typo StarsWith vs StartsWith diff --git a/src/CosmoStore/RELEASE_NOTES.md b/src/CosmoStore/RELEASE_NOTES.md index d5381a0..bf359e0 100644 --- a/src/CosmoStore/RELEASE_NOTES.md +++ b/src/CosmoStore/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +### 2.1.0 - May 14 2019 +* Added helper functions for validation and conversion + ### 2.0.1 - February 12 2019 * Fixing typo StarsWith vs StartsWith