hunk.code_window:             await dataSource.queryResultCache.clear()
               console.log(chalk.green("Cache was successfully cleared"))
               await dataSource.destroy()
           } catch (err) {
               if (dataSource) await (dataSource as DataSource).destroy()
               PlatformTools.logCmdErr("Error during cache clear.", err)
  
hunk.labels: keep keep keep keep keep replace replace keep keep
hunk.file_path: src/commands/CacheClearCommand.ts
hunk.type: replace
file: import { DataSource } from "../data-source/DataSource"
  import * as yargs from "yargs"
  import chalk from "chalk"
  import { PlatformTools } from "../platform/PlatformTools"
  import path from "path"
  import process from "process"
  import { CommandUtils } from "./CommandUtils"
  
  /**
   * Synchronizes database schema with entities.
   */
  export class SchemaSyncCommand implements yargs.CommandModule {
      command = "schema:sync"
      describe =
          "Synchronizes your entities with database schema. It runs schema update queries on all connections you have. " +
          "To run update queries on a concrete connection use -c option."
  
      builder(args: yargs.Argv) {
          return args.option("dataSource", {
              alias: "d",
              describe:
                  "Path to the file where your DataSource instance is defined.",
              demandOption: true,
          })
      }
  
      async handler(args: yargs.Arguments) {
          let dataSource: DataSource | undefined = undefined
          try {
              dataSource = await CommandUtils.loadDataSource(
                  path.resolve(process.cwd(), args.dataSource as string),
              )
              dataSource.setOptions({
                  synchronize: false,
                  migrationsRun: false,
                  dropSchema: false,
                  logging: ["query", "schema"],
              })
              await dataSource.initialize()
              await dataSource.synchronize()
              await dataSource.destroy()
  
              console.log(
                  chalk.green("Schema synchronization finished successfully."),
              )
          } catch (err) {
              if (dataSource) await dataSource.destroy()
  
              PlatformTools.logCmdErr("Error during schema synchronization:", err)
              process.exit(1)
          }
      }
  }
  