Skip to content

PostgreSQLModel should use Int64 (instead of int) #47

@brntphish

Description

@brntphish

When utilizing PostgreSQLModel in Vapor 3 the int declared as the id is actually stored as a bigint in postgres according to pgadmin. However you cannot declare id as an Int64/bigint

final class myClass: Codable {
  var id: Int?
  var name: String
  var createdAt: Date?
  var updatedAt: Date?
  
  // MARK: Init
  init(name: String) {
    self.name = name
  }
  
  init(id: Int, name: String) {
    self.id = id
    self.name = name
  }
}

screen shot 2018-05-04 at 6 00 26 pm

if already being stored as a bigint in pg, I purpose just changing the int? to an Int64? to prevent breaking any bigint keys that already exist.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions