I am trying to seed a uuid using sequilize generateUUID
but i get this error Seed file failed with error: sequelize.Utils.generateUUID is not a function TypeError: sequelize.Utils.generateUUID is not a function
how do i seed a UUID?
return queryInterface.bulkInsert('companies', [{
id: sequelize.Utils.generateUUID(),
name: 'Testing',
updated_at: new Date(),
created_at: new Date()
}]);
just install uuid:
npm install uuid
and on your seed file:
const uuidv4 = require('uuid/v4');
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.bulkInsert('yourTableName', [
{
id: uuidv4()
}],
{});