CodableDatastore
CodableDatastore copied to clipboard
Consider flipping data and decoder in migrations
trafficstars
Currently, when defining migrations using the shorthand $0/1 syntax, the data and decoder is used in the opposite order:
static func datastore(for persistence: DiskPersistence<ReadWrite>) -> Datastore {
.JSONStore(
persistence: persistence,
key: datastoreKey,
version: .zero,
migrations: [
.zero: { try $1.decode(KeyValue.self, from: $0) }
]
)
}