Last active
November 13, 2018 12:14
-
-
Save ldmarz/5468e89045352ddeb54b8d887f199490 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
extension User: Migration { | |
static func prepare(on connection: PostgreSQLConnection) -> Future<void> { | |
return Database.create(self, on: connection) { builder in | |
builder.field(for: \.id, type: .int, isIdentifier: true) | |
builder.field(for: \.email, type: .string, .notNull) | |
builder.field(for: \.lifeStory, type: .text) | |
builder.field(for: \.iq, type: .int, .default(.literal("123456"))) | |
builder.field(for: \.companyID, type: .int) | |
builder.reference(from: \.companyID, to: \Company.id) | |
builder.unique(on: \.email) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment