-1
Hello, I wanted to create a table using Migrations with sequelize, and create a position field of type GEOMETRY. The bank I’m using is the postgres.
I tried that code:
'use strict';
module.exports = {
up: (queryInterface, Sequelize, DataTypes) => {
return queryInterface.createTable('users', {
id: {
type: Sequelize.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true,
},
name: {
type: Sequelize.STRING,
},
position: {
type: Sequelize.GEOMETRY,
},
});
},
down: queryInterface => {
return queryInterface.dropTable('users');
}
};
Gives an error stating that type "Geometry" does not exist.
How do I set a field like this??
You have activated the extension
postgis
in your bank?– Cmte Cardeal
I don’t remember, but I don’t think so. How do I do it?
– natanfoleto
from the command line I think it’s like:
psql -U [superuser] [sua database] CREATE EXTENSION postgis;
. I’m not sure, but try the test. If not, do a search of how to activate this extension, for the postgres to recognize this multidimensional type of data.– Cmte Cardeal
I’ll try, as soon as I return result
– natanfoleto
is enabled but keeps giving error that is on top
– natanfoleto