You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand that GitHub issues are not for tech support, but for questions specific to this generator, bug reports, and feature requests.
Item
Version
generator-angular-fullstack
4.1.2
Node
6.9.4
npm
4.1.2
Operating System
OS X 10
Item
Answer
Transpiler
Babel
Markup
Pug
CSS
SCSS
Router
ui-router
Client Tests
Mocha
DB
Postgres
Auth
Y
Was getting a Sequelize error when doing a gulp serve on: sqldb.sequelize.sync()
in server/app.js
causing startServer to not be called. Turns out the issue was with:
if(config.seedDB) {
require('./config/seed');
}
Since seed.js calls .sync() and app.js also calls .sync(), sequelize was doubling up the queries causing a conflict in the creation of the sequence for the User table in PostgreSQL.
To resolve, I modified app.js slightly by removing the conditional above then changing:
sqldb.sequelize.sync()
.then(startServer)
.catch(function(err) {
console.log('Server failed to start due to error: ', err);
});
to
// Sync the database which will seed it (if appropriate) then startServer
sqldb.sequelize.sync()
.then(seedDatabaseIfNeeded)
.then(startServer)
.catch(err => console.log('Server failed to start due to error: ', err));
then modified server/config/seed.js to start with:
import config from './environment/';
import sqldb from '../sqldb';
export default function seedDatabaseIfNeeded() {
if(config.seedDB) { // Only run if enabled
// Original code to return the promise for User.destroy() and User.bulkCreate()
}
}
To reproduce, scaffold a fresh project with angular-fullstack including authentication with sequelize, configure it to connect to PostgreSQL 9.6.1, turn on sequelize logging and you should see duplicated queries being run during the initial seeding.
The text was updated successfully, but these errors were encountered:
Was getting a Sequelize error when doing a gulp serve on:
sqldb.sequelize.sync()
in server/app.js
causing startServer to not be called. Turns out the issue was with:
Since seed.js calls .sync() and app.js also calls .sync(), sequelize was doubling up the queries causing a conflict in the creation of the sequence for the User table in PostgreSQL.
To resolve, I modified app.js slightly by removing the conditional above then changing:
to
then modified server/config/seed.js to start with:
To reproduce, scaffold a fresh project with angular-fullstack including authentication with sequelize, configure it to connect to PostgreSQL 9.6.1, turn on sequelize logging and you should see duplicated queries being run during the initial seeding.
The text was updated successfully, but these errors were encountered: