Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Amplify/Categories/DataStore/Query/ModelKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ extension CodingKey where Self: ModelKey {

var columnName: String {
guard let modelSchema: ModelSchema = ModelRegistry.modelSchema(from: modelName) else {
log.warn("Please upgrade to the latest version of Amplify CLI and rerun `amplify codegen models`")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is removing the message the right thing here? What should a customer do to fix this if not upgrade & regen models?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message is printed out too often even you don't explicitly call DataStore.query().

For example:
During Amplify.DataStore.start(), clearStateOutgoingMutations will be called, it creates a predicate which accesses columnName, but MutationEvent is not in ModelRegistry so that it fails the guard comment and print out the warning message.

func clearStateOutgoingMutations(completion: @escaping BasicClosure) {
        let fields = MutationEvent.keys
        let predicate = fields.inProcess == true
        let sort = QuerySortDescriptor(fieldName: fields.createdAt.stringValue, order: .ascending)
        storageAdapter.query(MutationEvent.self,
                             predicate: predicate,
                             sort: [sort],
                             paginationInput: nil) { result in
                                switch result {
                                case .failure(let dataStoreError):
                                    log.error("Failed on clearStateOutgoingMutations: \(dataStoreError)")
                                case .success(let mutationEvents):
                                    if !mutationEvents.isEmpty {
                                        updateMutationsState(mutationEvents: mutationEvents,
                                                             completion: completion)
                                    } else {
                                        completion()
                                    }
                                }
        }
    }

But like you said, the removal of message won't tell customer the fix unless they create a Github issue and we reply to tell them.

return stringValue
}
switch modelSchema.field(withName: stringValue)?.association {
Expand Down