Reputation: 508
I have some question about modeling in Perfect and using StORM (MySQL-StORM in my case).
Assume we have models named User
and Note
with these simple rules:
id, firstName, lastName, age(optional)
id, title, content
Zero or more
notes.One
user.My questions are:
age
property null-able
in database?User
and Note
?something like this:
class User {
var id: UUID
var firstName: String
var lastName: String
var age: String? //this could be NULL-able,
var notes: [Note] //users notes
}
class Note {
var id: UUID
var title: String
var content: String
var owner: User //owner of the note
}
How can I implement this, using Perfect (Server-Side Swift) and MySQL-StORM?
Upvotes: 1
Views: 152