sequelize / sequelize-typescript

Decorators and some other features for sequelize

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting an error when trying to use MySQL POINT type

dlandtaa opened this issue · comments

Issue

I am trying to create a model with a field of type MySQL POINT like this:

@Table({ tableName: 'my_table', timestamps: false })
class MyTableModel extends Model {
    @Column({ field: 'lat_lon', type: DataType.GEOMETRY('POINT') })
    latLon: any;
}

I'm getting an error:

Error: Specified type of property 'latLon'
            cannot be automatically resolved to a sequelize data type. Please
            define the data type manually
    at getSequelizeTypeByDesignType (/my/code/node_modules/sequelize-typescript/dist/model/shared/model-service.js:64:11)
    at annotate (/my/code/node_modules/sequelize-typescript/dist/model/column/column.js:32:77)
    at /my/code/node_modules/sequelize-typescript/dist/model/column/column.js:18:9
    at DecorateProperty (/my/code/node_modules/reflect-metadata/Reflect.js:561:33)
    at Reflect.decorate (/my/code/node_modules/reflect-metadata/Reflect.js:136:24)
    at __decorate (/my/code/dist/src/data/model/MyModel.model.js:4:92)
    at Object.<anonymous> (/my/code/dist/src/data/model/MyModel.model.js:76:1)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)

Versions

  • sequelize: 6.36.0
  • sequelize-typescript: 2.1.6
  • typescript: 5.3.3

Issue type

  • bug report
  • feature request

Actual behavior

Getting the error above

Expected behavior

Should allow me to create the column

Never mind, stupid mistake on my part. The above works fine.