Matheus Assis
06/26/2020, 2:33 PMconst sql = fs.readFileSync(path.join(basePath, fileName), {
encoding: 'utf8'
});
await db.executeRaw(sql);
But I get:
PrismaClientKnownRequestError: Raw query failed. Code: `1064`. Message: `You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS `IndustrySector` (
`id` int NOT NULL AUTO_INCREMEN' at line 31`
at PrismaClientFetcher.request (D:\dev\perimetre\export-connect-backend\node_modules\@prisma\client\src\runtime\getPrismaClient.ts:902:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
code: 'P2010',
meta: {
code: '1064',
message: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS `IndustrySector` (\r\n" +
" `id` int NOT NULL AUTO_INCREMEN' at line 31"
}
}
Even though if I copy the contents of the sql file and use it with something like Mysql Workbench oh php my admin it works fine.
Is executeRaw not suited for that? Is there other way that I can do this?janpio
Matheus Assis
06/26/2020, 2:40 PMjanpio