public async ValueTask <ITimeoutsTarget.IEndpointTargetBatchMigrator> PrepareTargetEndpointBatchMigrator(string endpointName)
        {
            await EnsureConnectionOpen();
            await EnsureMigrationTableExists();

            var endpointDelayedTableName = SqlConstants.DelayedTableName(endpointName);

            var actualEndpointDelayedTableName = await SqlTQueueCreator
                                                 .DoesDelayedDeliveryTableExist(connection, endpointDelayedTableName, schema, connection.Database)
                                                 .ConfigureAwait(false);

            return(new SqlTEndpointTarget(logger, connection, actualEndpointDelayedTableName, schema));
        }
        public async ValueTask <MigrationCheckResult> AbleToMigrate(EndpointInfo endpoint)
        {
            var migrationCheckResult = new MigrationCheckResult();

            try
            {
                await EnsureConnectionOpen();
            }
            catch (Exception e)
            {
                migrationCheckResult.Problems.Add($"Unable to connect to the server or database using the provided connection string. Verify the connection string. The following exception occured: {e.Message}");
                return(migrationCheckResult);
            }

            var databaseName = connection.Database;

            try
            {
                await SqlTQueueCreator.CreateStagingQueue(connection, SqlConstants.TimeoutMigrationStagingTable, schema, databaseName, preview : true);
            }
            catch (Exception e)
            {
                migrationCheckResult.Problems.Add($"Attempt to verify whether the timeout migration staging table '{SqlConstants.TimeoutMigrationStagingTable}' could be created during migration mode failed. The following exception occured: {e.Message}");
            }

            var endpointDelayedTableName = SqlConstants.DelayedTableName(endpoint.EndpointName);

            if (await SqlTQueueCreator
                .DoesDelayedDeliveryTableExist(connection, endpointDelayedTableName, schema, databaseName)
                .ConfigureAwait(false) == null)
            {
                migrationCheckResult.Problems.Add($"Could not find delayed queue table with name '{endpointDelayedTableName}' for the endpoint '{endpoint.EndpointName}'");
            }

            return(migrationCheckResult);
        }