CodableDatastore icon indicating copy to clipboard operation
CodableDatastore copied to clipboard

Consider flipping data and decoder in migrations

Open dimitribouniol opened this issue 1 year ago • 0 comments
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) }
            ]
        )
    }

dimitribouniol avatar Mar 29 '24 09:03 dimitribouniol