Open knlklabacka opened 1 day ago
Here is more info.
QueryFailedError: constraint "FK_4c675567d2a58f0b07cef09c13d" for relation "comments" already exists
at PostgresQueryRunner.query (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\driver\postgres\PostgresQueryRunner.js:219:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PostgresQueryRunner.executeQueries (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\query-runner\BaseQueryRunner.js:425:13)
at async PostgresQueryRunner.createForeignKey (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\driver\postgres\PostgresQueryRunner.js:1446:9)
at async PostgresQueryRunner.createForeignKeys (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\driver\postgres\PostgresQueryRunner.js:1454:13)
at async RdbmsSchemaBuilder.createForeignKeys (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\schema-builder\RdbmsSchemaBuilder.js:775:13)
at async RdbmsSchemaBuilder.executeSchemaSyncOperationsInProperOrder (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\schema-builder\RdbmsSchemaBuilder.js:176:9)
at async RdbmsSchemaBuilder.build (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\schema-builder\RdbmsSchemaBuilder.js:66:13)
at async DataSource.synchronize (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\data-source\DataSource.js:211:9)
at async DataSource.initialize (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\data-source\DataSource.js:156:17) {
query: 'ALTER TABLE "comments" ADD CONSTRAINT "FK_4c675567d2a58f0b07cef09c13d" FOREIGN KEY ("user_id") REFERENCES "tasks"("task_id") ON DELETE NO ACTION ON UPDATE NO ACTION',
parameters: undefined,
driverError: error: constraint "FK_4c675567d2a58f0b07cef09c13d" for relation "comments" already exists
at D:\Documents\nodejs\ava-pms-be\node_modules\pg\lib\client.js:535:17
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PostgresQueryRunner.query (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\driver\postgres\PostgresQueryRunner.js:184:25)
at async PostgresQueryRunner.executeQueries (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\query-runner\BaseQueryRunner.js:425:13)
at async PostgresQueryRunner.createForeignKey (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\driver\postgres\PostgresQueryRunner.js:1446:9)
at async PostgresQueryRunner.createForeignKeys (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\driver\postgres\PostgresQueryRunner.js:1454:13)
at async RdbmsSchemaBuilder.createForeignKeys (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\schema-builder\RdbmsSchemaBuilder.js:775:13)
at async RdbmsSchemaBuilder.executeSchemaSyncOperationsInProperOrder (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\schema-builder\RdbmsSchemaBuilder.js:176:9)
at async RdbmsSchemaBuilder.build (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\schema-builder\RdbmsSchemaBuilder.js:66:13)
at async DataSource.synchronize (D:\Documents\nodejs\ava-pms-be\node_modules\typeorm\data-source\DataSource.js:211:9) {
length: 150,
severity: 'ERROR',
code: '42710',
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: '8910',
routine: 'ATExecAddConstraint'
},
length: 150,
severity: 'ERROR',
code: '42710',
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: '8910',
routine: 'ATExecAddConstraint'
}
Hello! I'm new to react and node, so I'm sorry if this question is obvious. I'm at the end of chapter four and trying to run the project. I'm getting the following output.
I understand that it's trying to create a FKey but I'm not sure how to fix this. Can you help please?