Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/note.picotech.app/public_html/node_modules/umzug/lib/storages/ drwxr-xr-x | |
| Viewing file: Select action/file-type: "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _Storage = _interopRequireDefault(require("./Storage"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @class MongoDBStorage
*/
class MongoDBStorage extends _Storage.default {
/**
* Constructs MongoDB collection storage.
*
* @param {Object} [options]
* Required either connection and collectionName OR collection
* @param {String} [options.connection] - a connection to target database established with MongoDB Driver
* @param {String} [options.collectionName] - name of migration collection in MongoDB
* @param {String} [options.collection] - reference to a MongoDB Driver collection
*/
constructor({
connection,
collectionName,
collection
}) {
super();
this.connection = connection;
this.collection = collection;
this.collectionName = collectionName || 'migrations';
if (!this.connection && !this.collection) {
throw new Error('MongoDB Connection or Collection required');
}
if (!this.collection) {
this.collection = this.connection.collection(this.collectionName);
}
}
/**
* Logs migration to be considered as executed.
*
* @param {String} migrationName - Name of the migration to be logged.
* @returns {Promise}
*/
logMigration(migrationName) {
return this.collection.insertOne({
migrationName
});
}
/**
* Unlogs migration to be considered as pending.
*
* @param {String} migrationName - Name of the migration to be unlogged.
* @returns {Promise}
*/
unlogMigration(migrationName) {
return this.collection.removeOne({
migrationName
});
}
/**
* Gets list of executed migrations.
*
* @returns {Promise.<String[]>}
*/
executed() {
return this.collection.find({}).sort({
migrationName: 1
}).toArray().then(records => records.map(r => r.migrationName));
}
}
exports.default = MongoDBStorage; |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0046 ]-- |