Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data was not loaded #16

Closed
burakkilic opened this issue Sep 8, 2014 · 3 comments
Closed

Data was not loaded #16

burakkilic opened this issue Sep 8, 2014 · 3 comments

Comments

@burakkilic
Copy link

Hi;

My data is:

[{
    "model": "Language",
    "data": {
        "code": "en",
        "name": "English",
        "flag": "gb"
    }
}, {
    "model": "Language",
    "data": {
        "code": "tr",
        "name": "Türkçe",
        "flag": "tr"
    }
}, {
    "model": "Language",
    "data": {
        "code": "sv",
        "name": "Svenska",
        "flag": "sv"
    }
}

]

And code is:

var sequelize_fixtures = require('sequelize-fixtures'),
models = {
    Language: require('../app/models/language')
};
console.log("--------Fixtures started to load-------------");

sequelize_fixtures.loadFile('../fixtures/test_data.json', models, function() {
    console.log("Fixtures were loaded");
});

I see the fixtures loaded log, but there is no data in the db. Where am I wrong?

@domasx2
Copy link
Owner

domasx2 commented Sep 8, 2014

I don't see anything wrong with what you posted, can't say. See if you're pointing to correct fixtures file, check database logs for errors

@burakkilic
Copy link
Author

Ok

@ryannorris
Copy link

I've found the only way this works is if you use the absolute path to the file. E.g.

      fixtures.loadFile(__dirname + '/../fixtures/*.json', models, function() {
        console.log('---fixtures loaded---');
      });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants