Skip to content

Instantly share code, notes, and snippets.

@ldmarz
Created November 12, 2018 18:32
Show Gist options
  • Save ldmarz/2dbf465eceb1dd5eb096f781a62bc705 to your computer and use it in GitHub Desktop.
Save ldmarz/2dbf465eceb1dd5eb096f781a62bc705 to your computer and use it in GitHub Desktop.
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)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment