Skip to content

Instantly share code, notes, and snippets.

@candostdagdeviren
Created May 21, 2017 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save candostdagdeviren/3fe9754017c4e12b217313524f566291 to your computer and use it in GitHub Desktop.
Save candostdagdeviren/3fe9754017c4e12b217313524f566291 to your computer and use it in GitHub Desktop.
Vapor 1 -> 2 Migration
final class User: Model {
let storage = Storage()
var name: String
var score: Int
init(row: Row) throws {
name = try row.get("name")
score = try row.get("score")
}
func makeRow() throws -> Row {
var row = Row()
try row.set("name", name)
try row.set("score", score)
return row
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment