@emigrate/cli
Version:
Emigrate is a tool for managing database migrations. It is designed to be simple yet support advanced setups, modular and extensible.
30 lines • 1.01 kB
JavaScript
import path from 'node:path';
import { withLeadingPeriod } from './with-leading-period.js';
import { MigrationHistoryError } from './errors.js';
export const toMigrationMetadata = (entry, { cwd, directory }) => {
const filePath = path.resolve(cwd, directory, entry.name);
if (entry.status === 'failed') {
return {
name: entry.name,
status: entry.status,
filePath,
relativeFilePath: path.relative(cwd, filePath),
extension: withLeadingPeriod(path.extname(entry.name)),
directory,
cwd,
duration: 0,
error: MigrationHistoryError.fromHistoryEntry(entry),
};
}
return {
name: entry.name,
status: entry.status,
filePath,
relativeFilePath: path.relative(cwd, filePath),
extension: withLeadingPeriod(path.extname(entry.name)),
directory,
cwd,
duration: 0,
};
};
//# sourceMappingURL=to-migration-metadata.js.map