Omid Golparvar
Omid Golparvar

Reputation: 508

Models in Perfect (Server-Side Swift) and StORM

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:

My questions are:

  1. What data-types does StORM support?
  2. How can I set age property null-able in database?
  3. How can I create relation between 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

Answers (0)

Related Questions