Reputation: 1473
I have 3 Model
objects in my project.
drop.preparations.append(Club.self)
drop.preparations.append(ClubPlayers.self)
drop.preparations.append(Player.self)
for some reason, Club table is not created. this is my prepare
method:
static func prepare(_ database: Database) throws {
try database.create(Club.tableName, closure: { club in
club.id()
club.string(Club.nameColumn)
club.string(Club.urlColumn)
})
}
it's built exactly as my other models, but it's the only one that is not being created. I don't receive any warning or error. I'm using Swift 3.1.1, vapor 1.5 and vapor-toolbox 2
Upvotes: 1
Views: 923
Reputation: 1473
My solution was: remove the 'Club' row from the 'fluent' table. then running vapor run prepare
did work.
There are also other options:
ADD COLUMN
command. http://www.postgresqltutorial.com/postgresql-add-column/Upvotes: 2