Guest User

Untitled

a guest
Oct 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import Foundation
  2. import FluentMySQL
  3. import Vapor
  4.  
  5. struct Todo: Content, MySQLModel, Migration {
  6.  
  7. var id: Int?
  8. var title: String
  9. var content: String
  10. var dueDate: Date
  11.  
  12. public static func prepare(on connection: MySQLConnection) -> Future<Void> {
  13. return MySQLDatabase.create(self, on: connection, closure: { builder in
  14. builder.field(for: \.id, isIdentifier: true)
  15. builder.field(for: \.title)
  16. builder.field(for: \.content, type: .text())
  17. builder.field(for: \.dueDate)
  18. })
  19. }
  20.  
  21. }
Add Comment
Please, Sign In to add comment