Search code examples
swiftpostgresqlvapor

How to customize column name?


Vapor 3 uses the variable name defined in the model as the column name in the database. This is not ideal as for Swift I'd like to use standard lower camel case notation and for the database lower case with underscores.

Is there a way to define the column names in Vapor separately from the variable name?


Solution

  • Sure, just declare CodingKeys for your model.