nestjs – TypeORM transactions not working as expected

I am having a scenario where I need to save a record first and create few more tables when the record is saved successfully. But I don’t want any of these things happening isolate. What I mean by this is if there are some issues in tables creation I want the saved record to be rollback and similarly if there are some issues in saving the record I don’t want to proceed with tables creation. For this, I have used TypeORM transactions.

This is what I have tried so far:

import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { getManager, Repository } from 'typeorm';
import { CreateTenantDto } from './dto/create-tenant.dto';
import { UpdateTenantDto } from './dto/update-tenant.dto';
import { Tenant } from './entities/tenant.entity';

export class TenantService {

    private tenantRepo: Repository<Tenant>
  ) { }

  async create(createTenantDto: CreateTenantDto) {

    try {
      const { tenant_id, tenant_name } = createTenantDto
      const tenant = new Tenant()
      tenant.tenant_id = tenant_id
      tenant.tenant_name = tenant_name
      const createdTenant = await this.createTenantSchema(tenant_id, tenant)
      return {
        success: true,
        message: "Tenant created successfully!",
        data: createdTenant
    } catch (error) {
      return {
        success: false,
        error: "Problem in creating tenant!"

  async createTenantSchema(tenant_id: string, tenant: Tenant): Promise<void> {

    await getManager().transaction(async transactionalEntityManager => {
      // Step 1: Save the record
      // Step 2: Create first table
      await transactionalEntityManager.query(`
      CREATE TABLE ${tenant_id}__customer(
        customer_id int primary key auto_increment,
        firstname varchar(255),
        middlename varchar(255),
        lastname varchar(255),
        address varchar(255)
      // Step 3: Create second table query
      await transactionalEntityManager.query(`
      CREATE TABLE ${tenant_id}__product (
          product_id int primary key auto_increment,
          product_name varchar(255)

What I tested is, I made some syntax errors (removed TABLE string form the second query). But with no luck, the record is saved and the first table is created. This is something not expected with transactions, I guess. What am I missing over here?

P.S: I am using Nestjs for backend with TypeORM and MYSQL Database.