Migration Issue - The operation could not be completed. (PostgresNIO.PSQLError error 1.)
First of all I love Hummingbird 2 and Fluent.
Thank you very much for your effort!
I am building a small backend for an app and everything is great and works seemlessly.
But now I am running into an issue. I just added a new field `surname`
```
@Field(key: "surname")
var surname: String
```
And execute the following migration
```
struct AddSurnameEventMigration: AsyncMigration {
func prepare(on database: Database) async throws {
try await database.schema("events")
.field("surname", .string) // Add the surname field
.update()
}
func revert(on database: Database) async throws {
try await database.schema("events")
.deleteField("surname") // Remove the surname field
.update()
}
}
```
After making a Post request with the Controller responds with 200 and returns the whole model including the new `surname`

But it is not stored to the DB as I am seeing the error
```
binds=["64FCCE08-8591-4850-A481-E39F6C94A036", "Alpine", "Schulz", "2023-10-01 12:00:00 +0000", "ferrata", "18", "50.105849", "14.413999"] database-id=psql sql=INSERT INTO "events" ("id", "name", "surname", "date", "kind", "spots_left", "coordinates_latitude", "coordinates_longitude") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [PostgresKit] Executing query
The operation could not be completed. (PostgresNIO.PSQLError error 1.)
```
Also the DB schema was not updated with a new surname field
Help please. What am I doing wrong?
关闭于 2024-11-23 5 条评论