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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -