ben
02/17/2022, 5:07 PMawait prismaClient.$executeRaw(
Prisma.sql`CREATE DATABASE ${databaseId} TEMPLATE ${templateName};`
);
on postgres, getting STATEMENT: CREATE DATABASE $1 TEMPLATE $2;
through on the DB sideTyler Clendenin
02/18/2022, 12:06 AMNurul
02/18/2022, 6:51 AMconst databaseName = "testingdb";
const templateName = "template0";
const result = await prisma.$executeRawUnsafe(`CREATE DATABASE ${databaseName} TEMPLATE ${templateName};`);
console.log(result);
Here is a reference to executeRawUnsafe. Please note that you should sanitise your variables before passing them in a query to avoid potential risk of SQL Injection.ben
02/18/2022, 9:58 AMexecuteRawUnsafe
in a transactionNurul
02/18/2022, 10:39 AM