Created
May 24, 2020 18:18
-
-
Save littlebobert/694bedae125f378b2c35c39601d9d63b to your computer and use it in GitHub Desktop.
migration that imports from a CSV
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
final class MovieImport: Migration { | |
typealias Database = SQLiteDatabase | |
static func prepare(on conn: SQLiteConnection) -> EventLoopFuture<Void> { | |
MovieDatabase.shared.populateFromCSV(connection: conn) | |
return conn.eventLoop.newPromise(of: Void.self).futureResult // Is this correct? | |
} | |
static func revert(on conn: SQLiteConnection) -> EventLoopFuture<Void> { | |
print("reverting") | |
return conn.eventLoop.newPromise(of: Void.self).futureResult | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment