Skip to content

Instantly share code, notes, and snippets.

@tungptvn
Last active September 22, 2017 10:03
Show Gist options
  • Save tungptvn/df3607ec899987dfa2d4d4aec509b27a to your computer and use it in GitHub Desktop.
Save tungptvn/df3607ec899987dfa2d4d4aec509b27a to your computer and use it in GitHub Desktop.
var server = require('../server');
var ds = server.dataSources.db;
var lbTables =
[
'User', 'AccessToken', 'ACL', 'RoleMapping', 'Role',
'AnswersForAQuestion','ApplicationUser','Question','Quiz','UsersQuizs'
];
ds.automigrate(lbTables, function(er) {
if (er) throw er;
console.log('Loopback tables [' + lbTables + '] created in ', ds.adapter.name);
ds.disconnect();
});
{
"mdb": {
"name": "mdb",
"connector": "memory"
},
"db": {
"host": "127.0.0.1",
"port": 5432,
"database": "EIC_DB",
"password": "Admin!@#456",
"name": "db",
"user": "postgres",
"connector": "postgresql",
"min": 5,
"max": 200,
"idleTimeoutMillis": 60000
},
"eicsfiles": {
"name": "eicsfiles",
"connector": "loopback-component-storage",
"provider": "filesystem",
"root": "./server/storage"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment