Last active
January 28, 2020 16:38
-
-
Save maximkrouk/2d704a9e8eaa9a7b7c72bd472076e5d9 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
import Fluent | |
private struct _Migration<T>: Migration { | |
var preparation: (Database) -> EventLoopFuture<Void> | |
var revertion: (Database) -> EventLoopFuture<Void> | |
func prepare(on database: Database) -> EventLoopFuture<Void> { preparation(database) } | |
func revert(on database: Database) -> EventLoopFuture<Void> { revertion(database) } | |
} | |
public protocol MigrationProvider { | |
static func prepare(on database: Database) -> EventLoopFuture<Void> | |
static func revert(on database: Database) -> EventLoopFuture<Void> | |
} | |
extension MigrationProvider { | |
public static var migration: Migration { | |
_Migration<Self>(preparation: prepare, revertion: revert) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment