Zaid-Ajaj / tabula-rasa

Minimalistic real-worldish blogging platform, written entirely in F#, made as a learning reference for building large Elmish apps
199 stars 16 forks source link

Error creating a database file on macOS (simple fix included) #34

Open LuisFX opened 3 years ago

LuisFX commented 3 years ago

When the server tries to initialize the database by running "new LiteDatabase(dbFile, mapper)", it throws the error:

System.InvalidOperationException: Your platform does not support FileStream.Lock. Please set mode=Exclusive in your connnection string to avoid this error.

Fixed by simply replacing the following: (Server>Storage.fs)

new LiteDatabase(dbFile, mapper)

With:

let cnn = ConnectionString(sprintf "filename=%s; mode=Exclusive" dbFile)
new LiteDatabase(cnn, mapper)