0

I am trying to insert the dummy data using sequelize-cli command

sequelize db:seed --seed seeders/20170212081140-subject_tags.js

here is my config file

{
  "development": {
    "username": "root",
    "password": null,
    "database": "database_development",
    "host": "127.0.0.1",
    "dialect": "sqlite",
    "seederStorage": "sequelize",
    "storage": "./test"
  }
}

and here my seeder file

use strict';

module.exports = {
  up: function(queryInterface, Sequelize) {

    return 
      queryInterface.bulkUpdate('subject_tags', [

      {
        tag: 'agricultural-sciences',
        tag_description: '',
        subject_category: 'biological_&_medical_sciences',
        createdAt: new Date(),
        updatedAt: new Date()
      }, {
        tag: 'biochemistry',
        tag_description: '',
        subject_category: 'biological_&_medical_sciences',
        createdAt: new Date(),
        updatedAt: new Date()
      }, {
        tag: 'bioinformatics',
        tag_description: '',
        subject_category: 'biological_&_medical_sciences',
        createdAt: new Date(),
        updatedAt: new Date()
      }
    ] , {});
  },

  down: function(queryInterface, Sequelize) {
     return 
      queryInterface.bulkDelete('subject_tags', null, {});

  }
}; 

Though I am getting the status

Using environment "development".
== 20170212081140-subject_tags: migrating =======
== 20170212081140-subject_tags: migrated (0.053s)

I tried bulkCreate and bulkInsert in the seed file , all of them run successful, but data does not get inserted into the table the data does not get inserted. Is I am doing something wrong?

made_in_india
  • 2,109
  • 5
  • 40
  • 63

2 Answers2

1

It seems to be issue with sequlizer, after return statement it unable to handle space with newline character

module.exports = {
  up: function(queryInterface, Sequelize) {
    //old code
    //return 
    //  queryInterface.bulkUpdate('subject_tags', [

    //new code
    return queryInterface.bulkUpdate('subject_tags', [
    //.........
made_in_india
  • 2,109
  • 5
  • 40
  • 63
0

Javascript will automatically add a semi-colon after a dangling return statement. It doesn't reach the bulkUpdate code.

Maki
  • 890
  • 1
  • 7
  • 13