Merge pull request #320 from 5t111111/fix-migration-example-code

Fix example codes in Fluent migration
This commit is contained in:
Tanner 2018-05-15 18:46:04 -04:00 committed by GitHub
commit a14c36d345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -37,7 +37,7 @@ we will use the `.create(...)` function on the supplied database connection.
extension User: Migration {
/// See Migration.prepare
static func prepare(on connection: MySQLConnection) -> Future<Void> {
return connection.create(self) { builder in
return MySQLDatabase.create(self, on: connection) { builder in
try builder.field(for: \.id)
try builder.field(for: \.name)
try builder.field(for: \.age)
@ -75,7 +75,7 @@ To implement `revert` for our model, we simply use `.delete` to indicate that we
extension User: Migration {
/// See Migration.revert
static func revert(on connection: MySQLConnection) -> Future<Void> {
return connection.delete(self)
return MySQLDatabase.delete(self, on: connection)
}
}
```
@ -88,7 +88,7 @@ We now have a fully functioning model with migration!
extension TestUser: Migration {
/// See Migration.prepare
static func prepare(on connection: SQLiteConnection) -> Future<Void> {
return connection.create(self) { builder in
return SQLiteDatabase.create(self, on: connection) { builder in
try builder.field(for: \.id)
try builder.field(for: \.name)
try builder.field(for: \.age)
@ -97,7 +97,7 @@ extension TestUser: Migration {
/// See Migration.revert
static func revert(on connection: SQLiteConnection) -> Future<Void> {
return connection.delete(self)
return SQLiteDatabase.delete(self, on: connection)
}
}
```