Estou utilizando o curso "Nest.js: lidando com migrações, relacionamentos ORM e erros em uma API" como base para montar minha aplicação, não estou fazendo a mesma aplicação do curso mas estou usando os conceitos.
Estou utilizando o banco de dados do planetscale que é mysql.
E está ocorrendo este error comigo quando eu roda as migrations:
query failed: ALTER TABLE `subscriptions` ADD CONSTRAINT `FK_fbdba4e2ac694cf8c9cecf4dc84` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
error: Error: VT10001: foreign key constraints are not allowed
query: ROLLBACK
Error during migration run:
QueryFailedError: VT10001: foreign key constraints are not allowed
at Query.onResult (C:\Users\DELL\Desktop\rss_backend\node_modules\typeorm\src\driver\mysql\MysqlQueryRunner.ts:222:33)
at Query.execute (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\commands\command.js:36:14)
at PoolConnection.handlePacket (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\connection.js:478:34)
at PacketParser.onPacket (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\connection.js:97:12)
at PacketParser.executeStart (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\packet_parser.js:75:16)
at TLSSocket.<anonymous> (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\connection.js:392:25)
at TLSSocket.emit (node:events:513:28)
at TLSSocket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9) {
query: 'ALTER TABLE `subscriptions` ADD CONSTRAINT `FK_fbdba4e2ac694cf8c9cecf4dc84` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION',
parameters: undefined,
driverError: Error: VT10001: foreign key constraints are not allowed
at Packet.asError (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\packets\packet.js:728:17)
at Query.execute (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\commands\command.js:29:26)
at PoolConnection.handlePacket (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\connection.js:478:34)
at PacketParser.onPacket (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\connection.js:97:12)
at PacketParser.executeStart (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\packet_parser.js:75:16)
at TLSSocket.<anonymous> (C:\Users\DELL\Desktop\rss_backend\node_modules\mysql2\lib\connection.js:392:25)
at TLSSocket.emit (node:events:513:28)
at TLSSocket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9) {
code: 'ER_UNKNOWN_ERROR',
errno: 1105,
sqlState: 'HY000',
sqlMessage: 'VT10001: foreign key constraints are not allowed',
sql: 'ALTER TABLE `subscriptions` ADD CONSTRAINT `FK_fbdba4e2ac694cf8c9cecf4dc84` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE NO ACEY (`userId`) REFERENCES `users`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION'
},
code: 'ER_UNKNOWN_ERROR',
errno: 1105,
sqlState: 'HY000',
sqlMessage: 'VT10001: foreign key constraints are not allowed',
sql: 'ALTER TABLE `subscriptions` ADD CONSTRAINT `FK_fbdba4e2ac694cf8c9cecf4dc84` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE NO ACTI (`userId`) REFERENCES `users`(`id`) ON DELETE NO ACTION ON UPDATE NO ACTION'
}
Se puderem ajudar.