feat(table-designer): 补齐 MySQL 空间字段类型

- 补充 Geometry、Point、MultiPoint 等八种 MySQL 空间类型候选
- 保留自定义字段类型表达式在建表和改表 SQL 中的原样输出
- 增加空间类型候选及 POINT SRID 属性回归测试

Fixes #341
This commit is contained in:
Syngnat
2026-07-18 16:15:33 +08:00
parent 5f5b28ced3
commit aeecffb517
3 changed files with 43 additions and 0 deletions

View File

@@ -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',

View File

@@ -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']));

View File

@@ -303,6 +303,14 @@ const MYSQL_TYPES = optionValues([
'timestamp',
'year',
'json',
'geometry',
'point',
'linestring',
'polygon',
'multipoint',
'multilinestring',
'multipolygon',
'geometrycollection',
'enum',
'set',
'bit(1)',