Repository: typeorm/typeorm
File: src/driver/postgres/PostgresDriver.ts (TypeScript)

Code before:
                    `CREATE EXTENSION IF NOT EXISTS "vector"`,
                )
            } catch (_) {
                logger.log(
                    "warn",
                    "At least one of the entities has a vector column, but the 'vector' extension (pgvector) cannot be installed automatically. Please install it manually using superuser rights",
                )
            }
        if (hasExclusionConstraints)
            try {
                // The btree_gist extension provides operator support in PostgreSQL exclusion constraints
                await this.executeQuery(
                    connection,
                    `CREATE EXTENSION IF NOT EXISTS "btree_gist"`,
                )
            } catch (_) {
                logger.log(
                    "warn",
                    "At least one of the entities has an exclusion constraint, but the 'btree_gist' extension cannot be installed automatically. Please install it manually using superuser rights",
                )
            }

        if (extensionsToInstall && extensionsToInstall.length > 0) {
            for (const extension of extensionsToInstall) {
                if (
                    availableExtensions &&
                    availableExtensions.size > 0 &&
                    !availableExtensions.has(extension)
                ) {
                    logger.log(
                        "warn",
                        `Extension '${extension}' is not available in your PostgreSQL installation. Please check the extension name or install it using superuser rights.`,
                    )
                    continue
                }

                try {
                    await this.executeQuery(
                        connection,
                        `CREATE EXTENSION IF NOT EXISTS "${extension}"`,
                    )
                } catch (_) {
                    logger.log(
                        "warn",
                        `The '${extension}' extension cannot be installed automatically. Please install it manually using superuser rights`,
                    )
                }
            }
        }
    }


Review comment (refactor):
Can we remove this if condition and filter `extensionsToInstall` outside of this method?  

Code after:
                logger.log(
                    "warn",
                    "At least one of the entities has a vector column, but the 'vector' extension (pgvector) cannot be installed automatically. Please install it manually using superuser rights",
                )
            }
        if (hasExclusionConstraints)
            try {
                // The btree_gist extension provides operator support in PostgreSQL exclusion constraints
                await this.executeQuery(
                    connection,
                    `CREATE EXTENSION IF NOT EXISTS "btree_gist"`,
                )
            } catch (_) {
                logger.log(
                    "warn",
                    "At least one of the entities has an exclusion constraint, but the 'btree_gist' extension cannot be installed automatically. Please install it manually using superuser rights",
                )
            }
    }

    protected async enableCustomExtensions(
        availableExtensions: Set<string>,
        extensionsToInstall: string[],
        connection: any,
    ) {
        if (!extensionsToInstall) return
        const logger = this.connection.logger
        for (const extension of extensionsToInstall) {
            if (availableExtensions.has(extension)) {
                try {
                    await this.executeQuery(
                        connection,
                        `CREATE EXTENSION IF NOT EXISTS "${extension}"`,
                    )
                } catch (_) {
                    logger.log(
                        "warn",
                        `The extension "${extension}" cannot be installed automatically. Please install it manually using superuser rights`,
                    )
                }
            } else {
                logger.log(
                    "warn",
                    `The extension "${extension}" is not available on this database. Please install it manually using superuser rights`,
                )
            }
        }
    }

    protected async checkMetadataForExtensions() {
        const hasUuidColumns = this.connection.entityMetadatas.some(