sequelize.js - How to define and use geo points in sequelize with mySQL -
i'm using sequelize orm connect mysql database - how define geo point in table/object model? since sequelize doesn't have point data type can pass in string represents mysql type?
db.define(modelname, { id: { type: sequelize.integer, primarykey: true, autoincrement: true, allownull: false }, location:{ type:'point' //how define this?? }, createdby: { type: sequelize.integer, references: { model: 'user', key: 'id' } }, photoid: { type: sequelize.uuid }, caption: { type: sequelize.string } }
since 3.4.0 sequelize support geometry postgres. based on commit messages, mysql supported.
you can add new attribute this:
point: { type: sequelize.geometry('point'), },
the supported types mysql are:
var supported_geometry_types = ['point', 'linestring', 'polygon'];
Comments
Post a Comment