Last active
November 8, 2018 17:43
-
-
Save ldmarz/afc58f2cc9a12111b8047e43f53f17d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var commands = CommandConfig.default() | |
commands.useFluentCommands() | |
services.register(commands) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import FluentPostgreSQL | |
import Vapor | |
struct AddFieldMock: Migration { | |
typealias Database = PostgreSQLDatabase | |
static func prepare( on connection: PostgreSQLConnection ) -> Future<Void> { | |
return Database.update(Acronym.self, on: connection) { builder in | |
builder.field(for: \.someFIeld) | |
} | |
} | |
static func revert(on connection: PostgreSQLConnection) -> EventLoopFuture<Void> { | |
return Database.update(Acronym.self, on: connection) { builder in | |
builder.deleteField(for: \.someFIeld) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vapor build && vapor run revert // To revert the last migration | |
vapor build && vapor run revert --all // To revert all migration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment