hunk.code_window:             if (dataSource) await dataSource.destroy()
               PlatformTools.logCmdErr("Error during migration run:", err)
               process.exit(1)
           }
       }
   }
hunk.labels: keep keep replace keep keep keep keep
hunk.file_path: src/commands/MigrationRunCommand.ts
hunk.type: replace
file: import "reflect-metadata"
  import { DataSource } from "../../../src/data-source/DataSource"
  import {
      closeTestingConnections,
      createTestingConnections,
  } from "../../utils/test-utils"
  
  describe("github issues > #1758 Synchronization bug in PostgreSQL bug occurs when we explicitly state the default schema as 'public'", () => {
      describe("postgres, cockroachdb", () => {
          let connections: DataSource[]
          before(async () => {
              connections = await createTestingConnections({
                  entities: [__dirname + "/entity/*{.js,.ts}"],
                  enabledDrivers: ["postgres", "cockroachdb"],
                  schema: "public",
                  schemaCreate: true,
                  dropSchema: true,
              })
          })
          after(() => closeTestingConnections(connections))
  
          it("should correctly synchronize schema when we explicitly state the default schema as 'public'", () =>
              Promise.all(
                  connections.map(async (connection) => {
                      await connection.synchronize()
                  }),
              ))
      })
  
      describe("mssql", () => {
          let connections: DataSource[]
          before(async () => {
              connections = await createTestingConnections({
                  entities: [__dirname + "/entity/*{.js,.ts}"],
                  enabledDrivers: ["mssql"],
                  schema: "dbo",
                  schemaCreate: true,
                  dropSchema: true,
              })
          })
          after(() => closeTestingConnections(connections))
  
          it("should correctly synchronize schema when we explicitly state the default schema as 'public'", () =>
              Promise.all(
                  connections.map(async (connection) => {
                      await connection.synchronize()
                  }),
              ))
      })
  })
  