I created a node express application with postgresql and node.js. I decided to put it on heroku. I created my postgresql database by using the add-on of heroku. I can see my database (username/password/uri etc.)
I can ping the heroku app but when I try to create a user I get a 400 error. I checked the logs and the problem is I can not create the tables.
Here is my app.js which should create the models using ORM.
var db = require('sequelize-connect');
// Database sequelize
var connectionString;
var username;
var password;
var database;
if (process.env.NODE_ENV === 'development'){
connectionString = global.localConnectionString;
database = global.nameDatabase_development;
username = global.usernameDatabase_development;
password = global.passwordDatabase_development;
}else{
connectionString = global.productionConnectionString;
database = global.nameDatabase_production;
username = global.usernameDatabase_production;
password = global.passwordDatabase_production;
}
var sequelize = new Sequelize(connectionString);
// Model ORM configurations
var discover = path.join(__dirname, 'models');
var matcher = function (file) {
return true;
}
var orm = new db(
database,
username,
password,
{
dialect: 'postgres',
port: 5432,
force: true
},
discover,
matcher
);
I got the database name/username/password from my heroku page. Do I have to create the tables manually on heroku? I thought sequelize-connect was used for that? How do I create tables on heroku?