Skip to content

feat(mysql)!: disable legacy spatial support by default for MySQL#12083

Merged
pkuczynski merged 3 commits intomasterfrom
mysql-disable-legacy-spatial-support
Mar 4, 2026
Merged

feat(mysql)!: disable legacy spatial support by default for MySQL#12083
pkuczynski merged 3 commits intomasterfrom
mysql-disable-legacy-spatial-support

Conversation

@pkuczynski
Copy link
Copy Markdown
Member

Change the default value of legacySpatialSupport from true to false for the MySQL driver. TypeORM now uses the standard-compliant ST_GeomFromText and ST_AsText spatial functions by default, which were introduced in MySQL 5.7 and are required by MySQL 8.0+ (the legacy GeomFromText and AsText functions were removed in MySQL 8.0).

Users on MySQL 5.6 or earlier can restore the old behavior by setting legacySpatialSupport: true explicitly.

Also moves the spatial MySQL test from test/github-issues/3702/ to test/functional/spatial/mysql/ to match the existing spatial test structure.

Fixes #12008

@pkuczynski pkuczynski self-assigned this Mar 4, 2026
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Disable legacy spatial support by default for MySQL

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Changed default legacySpatialSupport from true to false for MySQL
• Aligns with MySQL 8.0+ standard-compliant spatial functions
• Updated documentation and migration guide for users
• Reorganized spatial test to functional test structure
Diagram
flowchart LR
  A["MySQL Driver Config"] -->|"legacySpatialSupport: false"| B["Standard ST_GeomFromText/ST_AsText"]
  C["Documentation"] -->|"Updated defaults"| D["Migration Guide"]
  E["Test Structure"] -->|"Reorganized"| F["test/functional/spatial/mysql/"]
Loading

Grey Divider

File Changes

1. src/driver/mysql/MysqlDriver.ts ✨ Enhancement +1/-1

Set legacySpatialSupport default to false

• Changed default value of legacySpatialSupport from true to false
• Affects MySQL driver initialization in constructor

src/driver/mysql/MysqlDriver.ts


2. src/driver/mysql/MysqlDataSourceOptions.ts 📝 Documentation +1/-1

Update MysqlDataSourceOptions documentation

• Updated JSDoc comment to reflect new default value
• Changed documented default from true to false

src/driver/mysql/MysqlDataSourceOptions.ts


3. src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts 📝 Documentation +1/-1

Update AuroraMysqlDataSourceOptions documentation

• Updated JSDoc comment to reflect new default value
• Changed documented default from true to false

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts


View more (4)
4. test/functional/spatial/mysql/spatial-mysql.test.ts 🧪 Tests +4/-5

Reorganize spatial test to functional structure

• Reorganized test file from test/github-issues/3702/ to test/functional/spatial/mysql/
• Updated import paths to reflect new location
• Simplified test description from issue-specific to generic spatial test

test/functional/spatial/mysql/spatial-mysql.test.ts


5. docs/docs/drivers/mysql.md 📝 Documentation +1/-1

Update MySQL driver documentation defaults

• Updated legacySpatialSupport documentation to reflect new default
• Changed from "Current default: true" to "Default: false"

docs/docs/drivers/mysql.md


6. docs/docs/guides/8-migration-v1.md 📝 Documentation +14/-0

Add migration guide for spatial support changes

• Added new migration section for legacySpatialSupport default change
• Provided explanation of standard-compliant spatial functions
• Included code example for users needing legacy support

docs/docs/guides/8-migration-v1.md


7. test/functional/spatial/mysql/entity/LetterBox.ts Additional files +0/-0

...

test/functional/spatial/mysql/entity/LetterBox.ts


Grey Divider

Qodo Logo

@pkuczynski pkuczynski changed the title feat: disable legacy spatial support by default for MySQL feat(mysql)!: disable legacy spatial support by default for MySQL Mar 4, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 4, 2026

Deploying typeorm with  Cloudflare Pages  Cloudflare Pages

Latest commit: c9e18e6
Status: ✅  Deploy successful!
Preview URL: https://34595a57.typeorm.pages.dev
Branch Preview URL: https://mysql-disable-legacy-spatial.typeorm.pages.dev

View logs

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 4, 2026

commit: c9e18e6

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects bot commented Mar 4, 2026

Code Review by Qodo

🐞 Bugs (19) 📘 Rule violations (2) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

   /**
    * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
    */
   readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. MariaDB default also flips 🐞 Bug ✓ Correctness
Description
MysqlDriver is used for both mysql and mariadb, so changing the default to
legacySpatialSupport: false also changes MariaDB spatial SQL generation to ST_* functions by
default. If the intent was “MySQL-only”, this is a wider breaking change and may cause unexpected
runtime failures for MariaDB users unless they explicitly set legacySpatialSupport: true.
Code

src/driver/mysql/MysqlDriver.ts[R329-332]

       this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
           ...connection.options,
       } as MysqlDataSourceOptions
Evidence
The driver now hard-defaults legacySpatialSupport to false during option normalization. MariaDB
is explicitly treated as part of the MySQL family, and query builders use this flag to choose
between legacy and ST_* spatial functions for all MySQL-family drivers—therefore MariaDB behavior
changes too.

src/driver/mysql/MysqlDriver.ts[327-333]
src/driver/DriverUtils.ts[29-35]
src/query-builder/InsertQueryBuilder.ts[1645-1660]
src/query-builder/SelectQueryBuilder.ts[3020-3031]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`legacySpatialSupport` now defaults to `false` in `MysqlDriver`, but `MysqlDriver` also serves `mariadb`. This means MariaDB spatial SQL generation also flips to `ST_*` by default, which may be outside the intended scope (“MySQL-only”) and can surprise MariaDB users.
## Issue Context
- `DriverUtils.isMySQLFamily()` includes both `mysql` and `mariadb`.
- Spatial SQL generation in query builders uses `legacySpatialSupport` for all MySQL-family drivers.
## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[327-333]
- docs/docs/guides/8-migration-v1.md[13-29]
- docs/docs/drivers/mysql.md[1-72]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Default behavior untested 🐞 Bug ⛯ Reliability
Description
The spatial MySQL test suite covers only the explicit legacySpatialSupport: true and
legacySpatialSupport: false cases, but does not assert the new implicit default when the option is
omitted. This reduces confidence that the breaking default change will be protected from accidental
regressions.
Code

src/driver/mysql/MysqlDriver.ts[R330-331]

+            legacySpatialSupport: false,
           ...connection.options,
Evidence
The driver default was changed to false, but the moved test always supplies
driverSpecific.legacySpatialSupport explicitly in both test blocks, so the implicit-default path
is never exercised.

src/driver/mysql/MysqlDriver.ts[327-333]
test/functional/spatial/mysql/spatial-mysql.test.ts[10-23]
test/functional/spatial/mysql/spatial-mysql.test.ts[106-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Tests validate explicit true/false modes, but do not validate the new default behavior when `legacySpatialSupport` is omitted.
## Issue Context
Because this PR is explicitly changing a default, a regression test should assert the implicit default path.
## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-171]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (18)
4. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

  /**
   * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
   */
  readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Missing issue reference in test 📘 Rule violation ✓ Correctness
Description
The moved functional test no longer includes any issue reference (e.g., #12008) in a comment or
description, reducing traceability to the motivating bugfix. This does not meet the checklist
expectation to keep an issue reference in the functional test when applicable.
Code

test/functional/spatial/mysql/spatial-mysql.test.ts[10]

+describe("spatial > mysql", () => {
Evidence
Compliance ID 3 expects issue fixes to live under test/functional and include an issue reference
in the test comment/description when applicable; the updated describe(...) was changed to a
generic name and the prior issue reference was removed.

Rule 3: Prefer functional tests over per-issue tests
test/functional/spatial/mysql/spatial-mysql.test.ts[10-10]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The functional test was moved/renamed but no longer contains an issue reference (e.g., `#12008`) in a comment or the `describe(...)` text, reducing traceability.
## Issue Context
Checklist item 3 expects issue fixes to live in `test/functional` and to include an issue reference in the test comment when applicable.
## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-11]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. No pre-5.7 MySQL guardrail 🐞 Bug ⛯ Reliability
Description
With the new default, spatial inserts/updates/selects will generate ST_GeomFromText/ST_AsText
unless the user opts into legacy mode. For users on older MySQL versions (called out in the
migration guide), this will fail at runtime with function-not-found errors and no targeted warning
or auto-fallback.
Code

src/driver/mysql/MysqlDriver.ts[R322-325]

       this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
           ...connection.options,
       } as MysqlDataSourceOptions
Evidence
QueryBuilder SQL generation for MySQL-family spatial columns is controlled solely by
driver.options.legacySpatialSupport. With the new default false, ST_* functions are emitted. The
migration guide itself states these functions were introduced in MySQL 5.7 and advises MySQL 5.6
users to set legacySpatialSupport: true, implying a known runtime incompatibility. Since
MysqlDriver.connect() already fetches server version for other feature gating, TypeORM could
provide a clearer warning/exception (or an automatic fallback when the option is not explicitly
set).

src/query-builder/InsertQueryBuilder.ts[1645-1660]
docs/docs/guides/8-migration-v1.md[19-24]
src/driver/mysql/MysqlDriver.ts[388-409]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
After changing the default to `legacySpatialSupport: false`, MySQL servers that lack ST_* spatial functions (migration guide calls out MySQL 5.6 and earlier) will hit runtime SQL errors when using spatial columns. There is no version-based warning/auto-fallback even though the driver already retrieves server version.
## Issue Context
- SQL generation for MySQL-family spatial columns uses `legacySpatialSupport` to select between `GeomFromText` vs `ST_GeomFromText` and `AsText` vs `ST_AsText`.
- `MysqlDriver.connect()` retrieves `this.version` and already gates other capabilities via `VersionUtils`.
## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[320-410]
- src/query-builder/InsertQueryBuilder.ts[1645-1660]
- src/query-builder/SelectQueryBuilder.ts[3020-3031]
- src/query-builder/UpdateQueryBuilder.ts[584-607]
- docs/docs/guides/8-migration-v1.md[19-31]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

  /**
   * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
   */
  readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. MariaDB default also flips 🐞 Bug ✓ Correctness
Description
MysqlDriver is used for both mysql and mariadb, so changing the default to
legacySpatialSupport: false also changes MariaDB spatial SQL generation to ST_* functions by
default. If the intent was “MySQL-only”, this is a wider breaking change and may cause unexpected
runtime failures for MariaDB users unless they explicitly set legacySpatialSupport: true.
Code

src/driver/mysql/MysqlDriver.ts[R329-332]

      this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
          ...connection.options,
      } as MysqlDataSourceOptions
Evidence
The driver now hard-defaults legacySpatialSupport to false during option normalization. MariaDB
is explicitly treated as part of the MySQL family, and query builders use this flag to choose
between legacy and ST_* spatial functions for all MySQL-family drivers—therefore MariaDB behavior
changes too.

src/driver/mysql/MysqlDriver.ts[327-333]
src/driver/DriverUtils.ts[29-35]
src/query-builder/InsertQueryBuilder.ts[1645-1660]
src/query-builder/SelectQueryBuilder.ts[3020-3031]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`legacySpatialSupport` now defaults to `false` in `MysqlDriver`, but `MysqlDriver` also serves `mariadb`. This means MariaDB spatial SQL generation also flips to `ST_*` by default, which may be outside the intended scope (“MySQL-only”) and can surprise MariaDB users.
## Issue Context
- `DriverUtils.isMySQLFamily()` includes both `mysql` and `mariadb`.
- Spatial SQL generation in query builders uses `legacySpatialSupport` for all MySQL-family drivers.
## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[327-333]
- docs/docs/guides/8-migration-v1.md[13-29]
- docs/docs/drivers/mysql.md[1-72]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. Default behavior untested 🐞 Bug ⛯ Reliability
Description
The spatial MySQL test suite covers only the explicit legacySpatialSupport: true and
legacySpatialSupport: false cases, but does not assert the new implicit default when the option is
omitted. This reduces confidence that the breaking default change will be protected from accidental
regressions.
Code

src/driver/mysql/MysqlDriver.ts[R330-331]

+            legacySpatialSupport: false,
          ...connection.options,
Evidence
The driver default was changed to false, but the moved test always supplies
driverSpecific.legacySpatialSupport explicitly in both test blocks, so the implicit-default path
is never exercised.

src/driver/mysql/MysqlDriver.ts[327-333]
test/functional/spatial/mysql/spatial-mysql.test.ts[10-23]
test/functional/spatial/mysql/spatial-mysql.test.ts[106-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Tests validate explicit true/false modes, but do not validate the new default behavior when `legacySpatialSupport` is omitted.
## Issue Context
Because this PR is explicitly changing a default, a regression test should assert the implicit default path.
## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-171]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

 /**
  * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
  */
 readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Add old-MySQL warning 🐞 Bug ✓ Correctness
Description
The migration guide documents the workaround for MySQL 5.6 and earlier, but with the new default
legacySpatialSupport: false, failures will surface as SQL errors at query time. Since the driver
already fetches the server version during connect, adding a targeted runtime warning (or a clear
error) when connected to older MySQL versions can reduce debugging time.
Code

src/driver/mysql/MysqlDriver.ts[R322-325]

       this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
           ...connection.options,
       } as MysqlDataSourceOptions
Evidence
Query builders select ST_* functions when legacySpatialSupport is falsy, and the migration guide
explicitly notes that MySQL 5.6 or earlier requires setting legacySpatialSupport: true.
MysqlDriver.connect() already retrieves this.version and uses it for other feature toggles, but
does not emit any warning related to spatial-function compatibility.

src/query-builder/InsertQueryBuilder.ts[1645-1660]
src/query-builder/SelectQueryBuilder.ts[3020-3031]
docs/docs/guides/8-migration-v1.md[19-31]
src/driver/mysql/MysqlDriver.ts[388-409]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
With the new default (`legacySpatialSupport: false`), users on older MySQL versions will get runtime SQL errors when using spatial columns. The migration guide mentions this, but a runtime warning would make the failure mode far more diagnosable.
### Issue Context
- Query builders choose ST_* functions when `legacySpatialSupport` is falsy.
- `MysqlDriver.connect()` already fetches server version and uses it to toggle other features.
### Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[356-410]
- docs/docs/guides/8-migration-v1.md[19-31]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

  /**
   * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
   */
  readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


13. MariaDB default also flips 🐞 Bug ✓ Correctness
Description
MysqlDriver is used for both mysql and mariadb, so changing the default to
legacySpatialSupport: false also changes MariaDB spatial SQL generation to ST_* functions by
default. If the intent was “MySQL-only”, this is a wider breaking change and may cause unexpected
runtime failures for MariaDB users unless they explicitly set legacySpatialSupport: true.
Code

src/driver/mysql/MysqlDriver.ts[R329-332]

      this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
          ...connection.options,
      } as MysqlDataSourceOptions
Evidence
The driver now hard-defaults legacySpatialSupport to false during option normalization. MariaDB
is explicitly treated as part of the MySQL family, and query builders use this flag to choose
between legacy and ST_* spatial functions for all MySQL-family drivers—therefore MariaDB behavior
changes too.

src/driver/mysql/MysqlDriver.ts[327-333]
src/driver/DriverUtils.ts[29-35]
src/query-builder/InsertQueryBuilder.ts[1645-1660]
src/query-builder/SelectQueryBuilder.ts[3020-3031]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`legacySpatialSupport` now defaults to `false` in `MysqlDriver`, but `MysqlDriver` also serves `mariadb`. This means MariaDB spatial SQL generation also flips to `ST_*` by default, which may be outside the intended scope (“MySQL-only”) and can surprise MariaDB users.
## Issue Context
- `DriverUtils.isMySQLFamily()` includes both `mysql` and `mariadb`.
- Spatial SQL generation in query builders uses `legacySpatialSupport` for all MySQL-family drivers.
## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[327-333]
- docs/docs/guides/8-migration-v1.md[13-29]
- docs/docs/drivers/mysql.md[1-72]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


14. Default behavior untested 🐞 Bug ⛯ Reliability
Description
The spatial MySQL test suite covers only the explicit legacySpatialSupport: true and
legacySpatialSupport: false cases, but does not assert the new implicit default when the option is
omitted. This reduces confidence that the breaking default change will be protected from accidental
regressions.
Code

src/driver/mysql/MysqlDriver.ts[R330-331]

+            legacySpatialSupport: false,
          ...connection.options,
Evidence
The driver default was changed to false, but the moved test always supplies
driverSpecific.legacySpatialSupport explicitly in both test blocks, so the implicit-default path
is never exercised.

src/driver/mysql/MysqlDriver.ts[327-333]
test/functional/spatial/mysql/spatial-mysql.test.ts[10-23]
test/functional/spatial/mysql/spatial-mysql.test.ts[106-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Tests validate explicit true/false modes, but do not validate the new default behavior when `legacySpatialSupport` is omitted.
## Issue Context
Because this PR is explicitly changing a default, a regression test should assert the implicit default path.
## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-171]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


15. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

 /**
  * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
  */
 readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


16. Missing issue reference in test 📘 Rule violation ✓ Correctness
Description
The moved functional test no longer includes any issue reference (e.g., #12008) in a comment or
description, reducing traceability to the motivating bugfix. This does not meet the checklist
expectation to keep an issue reference in the functional test when applicable.
Code

test/functional/spatial/mysql/spatial-mysql.test.ts[10]

+describe("spatial > mysql", () => {
Evidence
Compliance ID 3 expects issue fixes to live under test/functional and include an issue reference
in the test comment/description when applicable; the updated describe(...) was changed to a
generic name and the prior issue reference was removed.

Rule 3: Prefer functional tests over per-issue tests
test/functional/spatial/mysql/spatial-mysql.test.ts[10-10]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The functional test was moved/renamed but no longer contains an issue reference (e.g., `#12008`) in a comment or the `describe(...)` text, reducing traceability.
## Issue Context
Checklist item 3 expects issue fixes to live in `test/functional` and to include an issue reference in the test comment when applicable.
## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-11]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


17. No pre-5.7 MySQL guardrail 🐞 Bug ⛯ Reliability
Description
With the new default, spatial inserts/updates/selects will generate ST_GeomFromText/ST_AsText
unless the user opts into legacy mode. For users on older MySQL versions (called out in the
migration guide), this will fail at runtime with function-not-found errors and no targeted warning
or auto-fallback.
Code

src/driver/mysql/MysqlDriver.ts[R322-325]

      this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
          ...connection.options,
      } as MysqlDataSourceOptions
Evidence
QueryBuilder SQL generation for MySQL-family spatial columns is controlled solely by
driver.options.legacySpatialSupport. With the new default false, ST_* functions are emitted. The
migration guide itself states these functions were introduced in MySQL 5.7 and advises MySQL 5.6
users to set legacySpatialSupport: true, implying a known runtime incompatibility. Since
MysqlDriver.connect() already fetches server version for other feature gating, TypeORM could
provide a clearer warning/exception (or an automatic fallback when the option is not explicitly
set).

src/query-builder/InsertQueryBuilder.ts[1645-1660]
docs/docs/guides/8-migration-v1.md[19-24]
src/driver/mysql/MysqlDriver.ts[388-409]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
After changing the default to `legacySpatialSupport: false`, MySQL servers that lack ST_* spatial functions (migration guide calls out MySQL 5.6 and earlier) will hit runtime SQL errors when using spatial columns. There is no version-based warning/auto-fallback even though the driver already retrieves server version.
## Issue Context
- SQL generation for MySQL-family spatial columns uses `legacySpatialSupport` to select between `GeomFromText` vs `ST_GeomFromText` and `AsText` vs `ST_AsText`.
- `MysqlDriver.connect()` retrieves `this.version` and already gates other capabilities via `VersionUtils`.
## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[320-410]
- src/query-builder/InsertQueryBuilder.ts[1645-1660]
- src/query-builder/SelectQueryBuilder.ts[3020-3031]
- src/query-builder/UpdateQueryBuilder.ts[584-607]
- docs/docs/guides/8-migration-v1.md[19-31]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


18. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

 /**
  * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
  */
 readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


19. MariaDB default also flips 🐞 Bug ✓ Correctness
Description
MysqlDriver is used for both mysql and mariadb, so changing the default to
legacySpatialSupport: false also changes MariaDB spatial SQL generation to ST_* functions by
default. If the intent was “MySQL-only”, this is a wider breaking change and may cause unexpected
runtime failures for MariaDB users unless they explicitly set legacySpatialSupport: true.
Code

src/driver/mysql/MysqlDriver.ts[R329-332]

     this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
         ...connection.options,
     } as MysqlDataSourceOptions
Evidence
The driver now hard-defaults legacySpatialSupport to false during option normalization. MariaDB
is explicitly treated as part of the MySQL family, and query builders use this flag to choose
between legacy and ST_* spatial functions for all MySQL-family drivers—therefore MariaDB behavior
changes too.

src/driver/mysql/MysqlDriver.ts[327-333]
src/driver/DriverUtils.ts[29-35]
src/query-builder/InsertQueryBuilder.ts[1645-1660]
src/query-builder/SelectQueryBuilder.ts[3020-3031]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`legacySpatialSupport` now defaults to `false` in `MysqlDriver`, but `MysqlDriver` also serves `mariadb`. This means MariaDB spatial SQL generation also flips to `ST_*` by default, which may be outside the intended scope (“MySQL-only”) and can surprise MariaDB users.
## Issue Context
- `DriverUtils.isMySQLFamily()` includes both `mysql` and `mariadb`.
- Spatial SQL generation in query builders uses `legacySpatialSupport` for all MySQL-family drivers.
## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[327-333]
- docs/docs/guides/8-migration-v1.md[13-29]
- docs/docs/drivers/mysql.md[1-72]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


20. Default behavior untested 🐞 Bug ⛯ Reliability
Description
The spatial MySQL test suite covers only the explicit legacySpatialSupport: true and
legacySpatialSupport: false cases, but does not assert the new implicit default when the option is
omitted. This reduces confidence that the breaking default change will be protected from accidental
regressions.
Code

src/driver/mysql/MysqlDriver.ts[R330-331]

+            legacySpatialSupport: false,
         ...connection.options,
Evidence
The driver default was changed to false, but the moved test always supplies
driverSpecific.legacySpatialSupport explicitly in both test blocks, so the implicit-default path
is never exercised.

src/driver/mysql/MysqlDriver.ts[327-333]
test/functional/spatial/mysql/spatial-mysql.test.ts[10-23]
test/functional/spatial/mysql/spatial-mysql.test.ts[106-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Tests validate explicit true/false modes, but do not validate the new default behavior when `legacySpatialSupport` is omitted.
## Issue Context
Because this PR is explicitly changing a default, a regression test should assert the implicit default path.
## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-171]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


21. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

/**
 * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
 */
readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@pkuczynski pkuczynski added this to the 1.0 milestone Mar 4, 2026
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

    /**
     * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
     */
    readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.

### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.

### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. MariaDB default also flips 🐞 Bug ✓ Correctness ⭐ New
Description
MysqlDriver is used for both mysql and mariadb, so changing the default to
legacySpatialSupport: false also changes MariaDB spatial SQL generation to ST_* functions by
default. If the intent was “MySQL-only”, this is a wider breaking change and may cause unexpected
runtime failures for MariaDB users unless they explicitly set legacySpatialSupport: true.
Code

src/driver/mysql/MysqlDriver.ts[R329-332]

        this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
            ...connection.options,
        } as MysqlDataSourceOptions
Evidence
The driver now hard-defaults legacySpatialSupport to false during option normalization. MariaDB
is explicitly treated as part of the MySQL family, and query builders use this flag to choose
between legacy and ST_* spatial functions for all MySQL-family drivers—therefore MariaDB behavior
changes too.

src/driver/mysql/MysqlDriver.ts[327-333]
src/driver/DriverUtils.ts[29-35]
src/query-builder/InsertQueryBuilder.ts[1645-1660]
src/query-builder/SelectQueryBuilder.ts[3020-3031]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`legacySpatialSupport` now defaults to `false` in `MysqlDriver`, but `MysqlDriver` also serves `mariadb`. This means MariaDB spatial SQL generation also flips to `ST_*` by default, which may be outside the intended scope (“MySQL-only”) and can surprise MariaDB users.

## Issue Context
- `DriverUtils.isMySQLFamily()` includes both `mysql` and `mariadb`.
- Spatial SQL generation in query builders uses `legacySpatialSupport` for all MySQL-family drivers.

## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[327-333]
- docs/docs/guides/8-migration-v1.md[13-29]
- docs/docs/drivers/mysql.md[1-72]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Default behavior untested 🐞 Bug ⛯ Reliability ⭐ New
Description
The spatial MySQL test suite covers only the explicit legacySpatialSupport: true and
legacySpatialSupport: false cases, but does not assert the new implicit default when the option is
omitted. This reduces confidence that the breaking default change will be protected from accidental
regressions.
Code

src/driver/mysql/MysqlDriver.ts[R330-331]

+            legacySpatialSupport: false,
            ...connection.options,
Evidence
The driver default was changed to false, but the moved test always supplies
driverSpecific.legacySpatialSupport explicitly in both test blocks, so the implicit-default path
is never exercised.

src/driver/mysql/MysqlDriver.ts[327-333]
test/functional/spatial/mysql/spatial-mysql.test.ts[10-23]
test/functional/spatial/mysql/spatial-mysql.test.ts[106-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Tests validate explicit true/false modes, but do not validate the new default behavior when `legacySpatialSupport` is omitted.

## Issue Context
Because this PR is explicitly changing a default, a regression test should assert the implicit default path.

## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-171]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

   /**
    * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
    */
   readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Copy link
Copy Markdown
Collaborator

@gioboa gioboa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's awesome 👏

…y-spatial-support

# Conflicts:
#	docs/docs/guides/8-migration-v1.md
@pkuczynski pkuczynski merged commit bfa9d13 into master Mar 4, 2026
20 checks passed
@pkuczynski pkuczynski deleted the mysql-disable-legacy-spatial-support branch March 4, 2026 23:52
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (5) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Missing issue reference in test 📘 Rule violation ✧ Quality ⭐ New
Description
The moved functional test no longer includes any issue reference (e.g., #12008) in a comment or
description, reducing traceability to the motivating bugfix. This does not meet the checklist
expectation to keep an issue reference in the functional test when applicable.
Code

test/functional/spatial/mysql/spatial-mysql.test.ts[10]

+describe("spatial > mysql", () => {
Evidence
Compliance ID 3 expects issue fixes to live under test/functional and include an issue reference
in the test comment/description when applicable; the updated describe(...) was changed to a
generic name and the prior issue reference was removed.

Rule 3: Prefer functional tests over per-issue tests
test/functional/spatial/mysql/spatial-mysql.test.ts[10-10]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The functional test was moved/renamed but no longer contains an issue reference (e.g., `#12008`) in a comment or the `describe(...)` text, reducing traceability.

## Issue Context
Checklist item 3 expects issue fixes to live in `test/functional` and to include an issue reference in the test comment when applicable.

## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-11]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. No pre-5.7 MySQL guardrail 🐞 Bug ⛯ Reliability ⭐ New
Description
With the new default, spatial inserts/updates/selects will generate ST_GeomFromText/ST_AsText
unless the user opts into legacy mode. For users on older MySQL versions (called out in the
migration guide), this will fail at runtime with function-not-found errors and no targeted warning
or auto-fallback.
Code

src/driver/mysql/MysqlDriver.ts[R322-325]

        this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
            ...connection.options,
        } as MysqlDataSourceOptions
Evidence
QueryBuilder SQL generation for MySQL-family spatial columns is controlled solely by
driver.options.legacySpatialSupport. With the new default false, ST_* functions are emitted. The
migration guide itself states these functions were introduced in MySQL 5.7 and advises MySQL 5.6
users to set legacySpatialSupport: true, implying a known runtime incompatibility. Since
MysqlDriver.connect() already fetches server version for other feature gating, TypeORM could
provide a clearer warning/exception (or an automatic fallback when the option is not explicitly
set).

src/query-builder/InsertQueryBuilder.ts[1645-1660]
docs/docs/guides/8-migration-v1.md[19-24]
src/driver/mysql/MysqlDriver.ts[388-409]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
After changing the default to `legacySpatialSupport: false`, MySQL servers that lack ST_* spatial functions (migration guide calls out MySQL 5.6 and earlier) will hit runtime SQL errors when using spatial columns. There is no version-based warning/auto-fallback even though the driver already retrieves server version.

## Issue Context
- SQL generation for MySQL-family spatial columns uses `legacySpatialSupport` to select between `GeomFromText` vs `ST_GeomFromText` and `AsText` vs `ST_AsText`.
- `MysqlDriver.connect()` retrieves `this.version` and already gates other capabilities via `VersionUtils`.

## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[320-410]
- src/query-builder/InsertQueryBuilder.ts[1645-1660]
- src/query-builder/SelectQueryBuilder.ts[3020-3031]
- src/query-builder/UpdateQueryBuilder.ts[584-607]
- docs/docs/guides/8-migration-v1.md[19-31]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

   /**
    * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
    */
   readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (3)
4. MariaDB default also flips 🐞 Bug ✓ Correctness
Description
MysqlDriver is used for both mysql and mariadb, so changing the default to
legacySpatialSupport: false also changes MariaDB spatial SQL generation to ST_* functions by
default. If the intent was “MySQL-only”, this is a wider breaking change and may cause unexpected
runtime failures for MariaDB users unless they explicitly set legacySpatialSupport: true.
Code

src/driver/mysql/MysqlDriver.ts[R329-332]

       this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
           ...connection.options,
       } as MysqlDataSourceOptions
Evidence
The driver now hard-defaults legacySpatialSupport to false during option normalization. MariaDB
is explicitly treated as part of the MySQL family, and query builders use this flag to choose
between legacy and ST_* spatial functions for all MySQL-family drivers—therefore MariaDB behavior
changes too.

src/driver/mysql/MysqlDriver.ts[327-333]
src/driver/DriverUtils.ts[29-35]
src/query-builder/InsertQueryBuilder.ts[1645-1660]
src/query-builder/SelectQueryBuilder.ts[3020-3031]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`legacySpatialSupport` now defaults to `false` in `MysqlDriver`, but `MysqlDriver` also serves `mariadb`. This means MariaDB spatial SQL generation also flips to `ST_*` by default, which may be outside the intended scope (“MySQL-only”) and can surprise MariaDB users.
## Issue Context
- `DriverUtils.isMySQLFamily()` includes both `mysql` and `mariadb`.
- Spatial SQL generation in query builders uses `legacySpatialSupport` for all MySQL-family drivers.
## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[327-333]
- docs/docs/guides/8-migration-v1.md[13-29]
- docs/docs/drivers/mysql.md[1-72]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Default behavior untested 🐞 Bug ⛯ Reliability
Description
The spatial MySQL test suite covers only the explicit legacySpatialSupport: true and
legacySpatialSupport: false cases, but does not assert the new implicit default when the option is
omitted. This reduces confidence that the breaking default change will be protected from accidental
regressions.
Code

src/driver/mysql/MysqlDriver.ts[R330-331]

+            legacySpatialSupport: false,
           ...connection.options,
Evidence
The driver default was changed to false, but the moved test always supplies
driverSpecific.legacySpatialSupport explicitly in both test blocks, so the implicit-default path
is never exercised.

src/driver/mysql/MysqlDriver.ts[327-333]
test/functional/spatial/mysql/spatial-mysql.test.ts[10-23]
test/functional/spatial/mysql/spatial-mysql.test.ts[106-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Tests validate explicit true/false modes, but do not validate the new default behavior when `legacySpatialSupport` is omitted.
## Issue Context
Because this PR is explicitly changing a default, a regression test should assert the implicit default path.
## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-171]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

  /**
   * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
   */
  readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (10) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Remediation recommended

1. Add old-MySQL warning 🐞 Bug ✧ Quality ⭐ New
Description
The migration guide documents the workaround for MySQL 5.6 and earlier, but with the new default
legacySpatialSupport: false, failures will surface as SQL errors at query time. Since the driver
already fetches the server version during connect, adding a targeted runtime warning (or a clear
error) when connected to older MySQL versions can reduce debugging time.
Code

src/driver/mysql/MysqlDriver.ts[R322-325]

        this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
            ...connection.options,
        } as MysqlDataSourceOptions
Evidence
Query builders select ST_* functions when legacySpatialSupport is falsy, and the migration guide
explicitly notes that MySQL 5.6 or earlier requires setting legacySpatialSupport: true.
MysqlDriver.connect() already retrieves this.version and uses it for other feature toggles, but
does not emit any warning related to spatial-function compatibility.

src/query-builder/InsertQueryBuilder.ts[1645-1660]
src/query-builder/SelectQueryBuilder.ts[3020-3031]
docs/docs/guides/8-migration-v1.md[19-31]
src/driver/mysql/MysqlDriver.ts[388-409]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
With the new default (`legacySpatialSupport: false`), users on older MySQL versions will get runtime SQL errors when using spatial columns. The migration guide mentions this, but a runtime warning would make the failure mode far more diagnosable.

### Issue Context
- Query builders choose ST_* functions when `legacySpatialSupport` is falsy.
- `MysqlDriver.connect()` already fetches server version and uses it to toggle other features.

### Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[356-410]
- docs/docs/guides/8-migration-v1.md[19-31]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

   /**
    * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
    */
   readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. MariaDB default also flips 🐞 Bug ✓ Correctness
Description
MysqlDriver is used for both mysql and mariadb, so changing the default to
legacySpatialSupport: false also changes MariaDB spatial SQL generation to ST_* functions by
default. If the intent was “MySQL-only”, this is a wider breaking change and may cause unexpected
runtime failures for MariaDB users unless they explicitly set legacySpatialSupport: true.
Code

src/driver/mysql/MysqlDriver.ts[R329-332]

       this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
           ...connection.options,
       } as MysqlDataSourceOptions
Evidence
The driver now hard-defaults legacySpatialSupport to false during option normalization. MariaDB
is explicitly treated as part of the MySQL family, and query builders use this flag to choose
between legacy and ST_* spatial functions for all MySQL-family drivers—therefore MariaDB behavior
changes too.

src/driver/mysql/MysqlDriver.ts[327-333]
src/driver/DriverUtils.ts[29-35]
src/query-builder/InsertQueryBuilder.ts[1645-1660]
src/query-builder/SelectQueryBuilder.ts[3020-3031]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`legacySpatialSupport` now defaults to `false` in `MysqlDriver`, but `MysqlDriver` also serves `mariadb`. This means MariaDB spatial SQL generation also flips to `ST_*` by default, which may be outside the intended scope (“MySQL-only”) and can surprise MariaDB users.
## Issue Context
- `DriverUtils.isMySQLFamily()` includes both `mysql` and `mariadb`.
- Spatial SQL generation in query builders uses `legacySpatialSupport` for all MySQL-family drivers.
## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[327-333]
- docs/docs/guides/8-migration-v1.md[13-29]
- docs/docs/drivers/mysql.md[1-72]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (8)
4. Default behavior untested 🐞 Bug ⛯ Reliability
Description
The spatial MySQL test suite covers only the explicit legacySpatialSupport: true and
legacySpatialSupport: false cases, but does not assert the new implicit default when the option is
omitted. This reduces confidence that the breaking default change will be protected from accidental
regressions.
Code

src/driver/mysql/MysqlDriver.ts[R330-331]

+            legacySpatialSupport: false,
           ...connection.options,
Evidence
The driver default was changed to false, but the moved test always supplies
driverSpecific.legacySpatialSupport explicitly in both test blocks, so the implicit-default path
is never exercised.

src/driver/mysql/MysqlDriver.ts[327-333]
test/functional/spatial/mysql/spatial-mysql.test.ts[10-23]
test/functional/spatial/mysql/spatial-mysql.test.ts[106-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Tests validate explicit true/false modes, but do not validate the new default behavior when `legacySpatialSupport` is omitted.
## Issue Context
Because this PR is explicitly changing a default, a regression test should assert the implicit default path.
## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-171]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

  /**
   * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
   */
  readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Missing issue reference in test 📘 Rule violation ✓ Correctness
Description
The moved functional test no longer includes any issue reference (e.g., #12008) in a comment or
description, reducing traceability to the motivating bugfix. This does not meet the checklist
expectation to keep an issue reference in the functional test when applicable.
Code

test/functional/spatial/mysql/spatial-mysql.test.ts[10]

+describe("spatial > mysql", () => {
Evidence
Compliance ID 3 expects issue fixes to live under test/functional and include an issue reference
in the test comment/description when applicable; the updated describe(...) was changed to a
generic name and the prior issue reference was removed.

Rule 3: Prefer functional tests over per-issue tests
test/functional/spatial/mysql/spatial-mysql.test.ts[10-10]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The functional test was moved/renamed but no longer contains an issue reference (e.g., `#12008`) in a comment or the `describe(...)` text, reducing traceability.
## Issue Context
Checklist item 3 expects issue fixes to live in `test/functional` and to include an issue reference in the test comment when applicable.
## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-11]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. No pre-5.7 MySQL guardrail 🐞 Bug ⛯ Reliability
Description
With the new default, spatial inserts/updates/selects will generate ST_GeomFromText/ST_AsText
unless the user opts into legacy mode. For users on older MySQL versions (called out in the
migration guide), this will fail at runtime with function-not-found errors and no targeted warning
or auto-fallback.
Code

src/driver/mysql/MysqlDriver.ts[R322-325]

       this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
           ...connection.options,
       } as MysqlDataSourceOptions
Evidence
QueryBuilder SQL generation for MySQL-family spatial columns is controlled solely by
driver.options.legacySpatialSupport. With the new default false, ST_* functions are emitted. The
migration guide itself states these functions were introduced in MySQL 5.7 and advises MySQL 5.6
users to set legacySpatialSupport: true, implying a known runtime incompatibility. Since
MysqlDriver.connect() already fetches server version for other feature gating, TypeORM could
provide a clearer warning/exception (or an automatic fallback when the option is not explicitly
set).

src/query-builder/InsertQueryBuilder.ts[1645-1660]
docs/docs/guides/8-migration-v1.md[19-24]
src/driver/mysql/MysqlDriver.ts[388-409]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
After changing the default to `legacySpatialSupport: false`, MySQL servers that lack ST_* spatial functions (migration guide calls out MySQL 5.6 and earlier) will hit runtime SQL errors when using spatial columns. There is no version-based warning/auto-fallback even though the driver already retrieves server version.
## Issue Context
- SQL generation for MySQL-family spatial columns uses `legacySpatialSupport` to select between `GeomFromText` vs `ST_GeomFromText` and `AsText` vs `ST_AsText`.
- `MysqlDriver.connect()` retrieves `this.version` and already gates other capabilities via `VersionUtils`.
## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[320-410]
- src/query-builder/InsertQueryBuilder.ts[1645-1660]
- src/query-builder/SelectQueryBuilder.ts[3020-3031]
- src/query-builder/UpdateQueryBuilder.ts[584-607]
- docs/docs/guides/8-migration-v1.md[19-31]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

  /**
   * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
   */
  readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. MariaDB default also flips 🐞 Bug ✓ Correctness
Description
MysqlDriver is used for both mysql and mariadb, so changing the default to
legacySpatialSupport: false also changes MariaDB spatial SQL generation to ST_* functions by
default. If the intent was “MySQL-only”, this is a wider breaking change and may cause unexpected
runtime failures for MariaDB users unless they explicitly set legacySpatialSupport: true.
Code

src/driver/mysql/MysqlDriver.ts[R329-332]

      this.options = {
-            legacySpatialSupport: true,
+            legacySpatialSupport: false,
          ...connection.options,
      } as MysqlDataSourceOptions
Evidence
The driver now hard-defaults legacySpatialSupport to false during option normalization. MariaDB
is explicitly treated as part of the MySQL family, and query builders use this flag to choose
between legacy and ST_* spatial functions for all MySQL-family drivers—therefore MariaDB behavior
changes too.

src/driver/mysql/MysqlDriver.ts[327-333]
src/driver/DriverUtils.ts[29-35]
src/query-builder/InsertQueryBuilder.ts[1645-1660]
src/query-builder/SelectQueryBuilder.ts[3020-3031]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`legacySpatialSupport` now defaults to `false` in `MysqlDriver`, but `MysqlDriver` also serves `mariadb`. This means MariaDB spatial SQL generation also flips to `ST_*` by default, which may be outside the intended scope (“MySQL-only”) and can surprise MariaDB users.
## Issue Context
- `DriverUtils.isMySQLFamily()` includes both `mysql` and `mariadb`.
- Spatial SQL generation in query builders uses `legacySpatialSupport` for all MySQL-family drivers.
## Fix Focus Areas
- src/driver/mysql/MysqlDriver.ts[327-333]
- docs/docs/guides/8-migration-v1.md[13-29]
- docs/docs/drivers/mysql.md[1-72]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Default behavior untested 🐞 Bug ⛯ Reliability
Description
The spatial MySQL test suite covers only the explicit legacySpatialSupport: true and
legacySpatialSupport: false cases, but does not assert the new implicit default when the option is
omitted. This reduces confidence that the breaking default change will be protected from accidental
regressions.
Code

src/driver/mysql/MysqlDriver.ts[R330-331]

+            legacySpatialSupport: false,
          ...connection.options,
Evidence
The driver default was changed to false, but the moved test always supplies
driverSpecific.legacySpatialSupport explicitly in both test blocks, so the implicit-default path
is never exercised.

src/driver/mysql/MysqlDriver.ts[327-333]
test/functional/spatial/mysql/spatial-mysql.test.ts[10-23]
test/functional/spatial/mysql/spatial-mysql.test.ts[106-119]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Tests validate explicit true/false modes, but do not validate the new default behavior when `legacySpatialSupport` is omitted.
## Issue Context
Because this PR is explicitly changing a default, a regression test should assert the implicit default path.
## Fix Focus Areas
- test/functional/spatial/mysql/spatial-mysql.test.ts[10-171]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Aurora default is implicit 🐞 Bug ⛯ Reliability
Description
AuroraMysqlDataSourceOptions now documents legacySpatialSupport as defaulting to false, but
AuroraMysqlDriver does not apply any explicit default (it just assigns connection.options).
Today this still behaves like false in the query builders (because undefined is falsy), but it’s
inconsistent with MysqlDriver and can become a footgun if future code checks for strict booleans
or serializes options expecting the documented default to be materialized.
Code

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[R33-37]

 /**
  * Use spatial functions like GeomFromText and AsText which are removed in MySQL 8.
-     * (Default: true)
+     * (Default: false)
  */
 readonly legacySpatialSupport?: boolean
Evidence
The Aurora options interface comment states a default, but the Aurora driver does not merge in that
default, unlike the MySQL driver which now explicitly sets it in its constructor.

src/driver/aurora-mysql/AuroraMysqlDataSourceOptions.ts[33-37]
src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
src/driver/mysql/MysqlDriver.ts[327-333]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AuroraMysqlDataSourceOptions` documents `legacySpatialSupport` as defaulting to `false`, but `AuroraMysqlDriver` does not actually set a default value; it assigns `connection.options` directly. This leaves `options.legacySpatialSupport` as `undefined` unless the user provides it.
### Issue Context
MySQL (`MysqlDriver`) now explicitly merges `{ legacySpatialSupport: false, ...connection.options }`. Aurora MySQL should follow the same pattern for consistency and to ensure the documented default is reflected in runtime options.
### Fix Focus Areas
- src/driver/aurora-mysql/AuroraMysqlDriver.ts[301-304]
- src/driver/mysql/MysqlDriver.ts[327-333]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

MySQL: legacy spatial support disabled by default

4 participants