Skip to content

Instantly share code, notes, and snippets.

@maximkrouk
Last active June 14, 2020 21:17
Show Gist options
  • Save maximkrouk/9ed63cc8670f57feb1ec250c14832671 to your computer and use it in GitHub Desktop.
Save maximkrouk/9ed63cc8670f57feb1ec250c14832671 to your computer and use it in GitHub Desktop.
import Fluent
extension Migrations {
func add(_ migration: _Migration) { _add(migration) }
fileprivate func _add<T: Fluent.Migration>(_ migration: T) { add(migration) }
}
struct _Migration: Migration {
var name: String
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) }
}
@maximkrouk
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment