Skip to content

Commit

Permalink
feat(video-conferencing-service): fixed package version, added migrat…
Browse files Browse the repository at this point in the history
…ions

gh-0
  • Loading branch information
akshatdubeysf committed May 1, 2021
1 parent 2a3f320 commit 756572f
Show file tree
Hide file tree
Showing 16 changed files with 6,108 additions and 7,969 deletions.
2 changes: 1 addition & 1 deletion sandbox/video-conferencing-ms-example/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ module.exports = {
'@typescript-eslint/interface-name-prefix': 'off',
'no-prototype-builtins': 'off',
},
};
};
26 changes: 12 additions & 14 deletions sandbox/video-conferencing-ms-example/migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@ const fs = require('fs');
const DBMigrate = require('db-migrate');
const path = require('path');
let isLocal = false;
dotenv.config({ path: `${process.env.INIT_CWD}/.env` });
dotenv.config({path: `${process.env.INIT_CWD}/.env`});

try {
if (fs.existsSync('.infolder')) {
isLocal = true;
}
if (fs.existsSync('.infolder')) {
isLocal = true;
}
} catch (err) {
console.info('\n');
console.info('\n');
}
if (
isLocal
) {
console.info(`Skipping migrations`);
if (isLocal) {
console.info(`Skipping migrations`);
} else {
const dbmigrate = DBMigrate.getInstance(true, {
config: './migrations/database.json'
});
dbmigrate.up();
}
const dbmigrate = DBMigrate.getInstance(true, {
config: './migrations/database.json',
});
dbmigrate.up();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,43 @@ var fs = require('fs');
var path = require('path');
var Promise;

function handleFile(filePath, resolve, reject) {
fs.readFile(filePath, {encoding: 'utf-8'}, function (err, data) {
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
}
/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function(options, seedLink) {
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function (options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
Promise = options.Promise;
};

exports.up = function(db) {
exports.up = function (db) {
var filePath = path.join(__dirname, 'sqls', '20210425200024-init-up.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
})
.then(function(data) {
return new Promise(function (resolve, reject) {
handleFile(filePath, resolve, reject);
}).then(function (data) {
return db.runSql(data);
});
};

exports.down = function(db) {
exports.down = function (db) {
var filePath = path.join(__dirname, 'sqls', '20210425200024-init-down.sql');
return new Promise( function( resolve, reject ) {
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (err) return reject(err);
console.log('received data: ' + data);

resolve(data);
});
})
.then(function(data) {
return new Promise(function (resolve, reject) {
handleFile(filePath, resolve, reject);
}).then(function (data) {
return db.runSql(data);
});
};

exports._meta = {
"version": 1
version: 1,
};
Loading

0 comments on commit 756572f

Please sign in to comment.