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 _bluebird = _interopRequireDefault(require("bluebird"));
var _fs = _interopRequireDefault(require("fs"));
var _path2 = _interopRequireDefault(require("path"));
var _Storage = _interopRequireDefault(require("./Storage"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @class JSONStorage
*/
class JSONStorage extends _Storage.default {
/**
* Constructs JSON file storage.
*
* @param {Object} [options]
* @param {String} [options.path='./umzug.json'] - Path to JSON file where
* the log is stored. Defaults './umzug.json' relative to process' cwd.
*/
constructor({
path = _path2.default.resolve(process.cwd(), 'umzug.json')
} = {}) {
super();
this.path = path;
}
/**
* Logs migration to be considered as executed.
*
* @param {String} migrationName - Name of the migration to be logged.
* @returns {Promise}
*/
logMigration(migrationName) {
const filePath = this.path;
const readfile = _bluebird.default.promisify(_fs.default.readFile);
const writefile = _bluebird.default.promisify(_fs.default.writeFile);
return readfile(filePath).catch(() => '[]').then(content => JSON.parse(content)).then(content => {
content.push(migrationName);
return writefile(filePath, JSON.stringify(content, null, ' '));
});
}
/**
* Unlogs migration to be considered as pending.
*
* @param {String} migrationName - Name of the migration to be unlogged.
* @returns {Promise}
*/
unlogMigration(migrationName) {
const filePath = this.path;
const readfile = _bluebird.default.promisify(_fs.default.readFile);
const writefile = _bluebird.default.promisify(_fs.default.writeFile);
return readfile(filePath).catch(() => '[]').then(content => JSON.parse(content)).then(content => {
content = content.filter(m => m !== migrationName);
return writefile(filePath, JSON.stringify(content, null, ' '));
});
}
/**
* Gets list of executed migrations.
*
* @returns {Promise.<String[]>}
*/
executed() {
const filePath = this.path;
const readfile = _bluebird.default.promisify(_fs.default.readFile);
return readfile(filePath).catch(() => '[]').then(content => JSON.parse(content));
}
}
exports.default = JSONStorage; |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0038 ]-- |