Replies: 1 comment 1 reply
-
Hi @morstin, I don't think there are any universal, correct solutions to these problems.
While I understand why it can be strange to have an optional ID in an So I personally think it is ok to conform to If you are willing to use macros you might be able to create some kind of @Draftable
struct Player {
var id: Int64
var name: String
}
// expands to:
struct Player {
var id: Int64
var name: String
struct Draft {
var id: Int64?
var name: String
}
} Then when creating players you can use
I don't think we are going to have much to say about this. Only thing that comes to mind is adding a SQLite trigger to execute when songs are deleted to then clean up empty albums. But this really isn't going to be the focus of our explorations. |
Beta Was this translation helpful? Give feedback.
-
@mbrandonw @stephencelis : Dear Brandon, Dear Stephen: thrilled that you are picking up SQLite / GRDB in your most recent episode. If you find time in this series, I would very interested in your take on:
How to conform the table structs as Player, Team to Identifiable?
What's the "right" way to use
autoIncrementedPrimaryKey
? groue/GRDB.swift#1435When using those structs in SwiftUI Lists / IdentifiedArrays this would be very helpful.
How to keep database consistency when deleting?
Deleting in a many-to-many relationship groue/GRDB.swift#1609
https://forums.swift.org/t/grdb-persistence-callback-diddelete-gives-no-db/74829
Thank you very much for the great series!
Beta Was this translation helpful? Give feedback.
All reactions