Hello.
I'm consistently seeing these errors on startup with a fresh PostgreSQL database:
⨯ Error: Failed query: ALTER TABLE "blogs" DROP CONSTRAINT "blogs_id_not_null";
params:
at ignore-listed frames {
query: 'ALTER TABLE "blogs" DROP CONSTRAINT "blogs_id_not_null";',
params: [],
payloadInitError: true,
digest: '2692782',
[cause]: error: column "id" is in a primary key
at ignore-listed frames {
length: 104,
severity: 'ERROR',
code: '42P16',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'tablecmds.c',
line: '14121',
routine: 'dropconstraint_internal'
}
}
Or
Error: Failed query: ALTER TABLE "users_sessions" DROP CONSTRAINT "users_sessions_id_not_null"; params: at ignore-listed frames { query: 'ALTER TABLE "users_sessions" DROP CONSTRAINT "users_sessions_id_not_null";', params: [], payloadInitError: true, digest: '1276317868', [cause]: error: column "id" is in a primary key at ignore-listed frames { length: 104, severity: 'ERROR', code: '42P16', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'tablecmds.c', line: '14121', routine: 'dropconstraint_internal' } } GET / 500 in 5570ms
The app throws a 500 error on first load, but everything works fine after a refresh. I'm not manually defining id in these collections, and I'm using the latest Payload version(3.58.0).
Is this a known issue with schema sync trying to drop NOT NULL constraints on primary keys? Any recommended fix or workaround?