diff --git a/frontend/src/components/tableDesignerSchemaSql.test.ts b/frontend/src/components/tableDesignerSchemaSql.test.ts index 38a8a863..60a799a5 100644 --- a/frontend/src/components/tableDesignerSchemaSql.test.ts +++ b/frontend/src/components/tableDesignerSchemaSql.test.ts @@ -358,6 +358,28 @@ describe('tableDesignerSchemaSql', () => { expect(tdengineSql).not.toContain('AFTER'); }); + it('keeps freely entered MySQL spatial type attributes in schema SQL', () => { + const location = baseColumn({ + _key: 'location', + name: 'location', + type: 'POINT SRID 4326', + nullable: 'NO', + }); + const createSql = buildCreateTablePreviewSql({ + tableName: 'places', + dbType: 'mysql', + columns: [location], + }); + const alterSql = buildAlterTablePreviewSql(buildInput({ + tableName: 'places', + originalColumns: [], + columns: [location], + })); + + expect(createSql).toContain('`location` POINT SRID 4326 NOT NULL'); + expect(alterSql).toContain('ADD COLUMN `location` POINT SRID 4326 NOT NULL'); + }); + it('builds StarRocks create table preview with OLAP engine and conservative distribution', () => { const sql = buildCreateTablePreviewSql({ tableName: 'sales.orders', diff --git a/frontend/src/utils/sqlDialect.test.ts b/frontend/src/utils/sqlDialect.test.ts index 8b900f20..c68172f0 100644 --- a/frontend/src/utils/sqlDialect.test.ts +++ b/frontend/src/utils/sqlDialect.test.ts @@ -79,6 +79,19 @@ describe('sqlDialect', () => { expect(values(resolveColumnTypeOptions('duckdb'))).toContain('STRUCT'); }); + it('offers every MySQL spatial column type', () => { + expect(values(resolveColumnTypeOptions('mysql'))).toEqual(expect.arrayContaining([ + 'geometry', + 'point', + 'linestring', + 'polygon', + 'multipoint', + 'multilinestring', + 'multipolygon', + 'geometrycollection', + ])); + }); + it('resolves Apache IoTDB completion keywords and functions independently', () => { expect(resolveSqlKeywords('iotdb')).toEqual(expect.arrayContaining(['ALIGN BY DEVICE', 'SHOW TIMESERIES', 'WITH DATATYPE'])); expect(names(resolveSqlFunctions('iotdb'))).toEqual(expect.arrayContaining(['DATE_BIN', 'DIFF', 'TOP_K'])); diff --git a/frontend/src/utils/sqlDialect.ts b/frontend/src/utils/sqlDialect.ts index 0c8e81bc..6c80f45d 100644 --- a/frontend/src/utils/sqlDialect.ts +++ b/frontend/src/utils/sqlDialect.ts @@ -303,6 +303,14 @@ const MYSQL_TYPES = optionValues([ 'timestamp', 'year', 'json', + 'geometry', + 'point', + 'linestring', + 'polygon', + 'multipoint', + 'multilinestring', + 'multipolygon', + 'geometrycollection', 'enum', 'set', 'bit(1)',