Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cressie176 committed Jan 7, 2024
1 parent 62faf1b commit 29bc13b
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 40 deletions.
6 changes: 3 additions & 3 deletions lib/marv-rdf-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ module.exports = (options) => {

function runMigration(migration, cb) {
const fileType = getFileType(migration);
if (!['sql', 'yaml', 'json'].includes(fileType)) return cb(new Error(`Unsupported file type: ${fileType}`));

if (fileType === 'sql') return pgDriver.runMigration(migration, cb);

const script = parseMigrationScript(migration, fileType);
Expand All @@ -36,9 +38,7 @@ module.exports = (options) => {
}

function getFileType(migration) {
const fileType = path.extname(migration.filename).replace(/^\./, '');
if (!['sql', 'yaml', 'json'].includes(fileType)) return cb(new Error(`Unsupported file type: ${fileType}`));
return fileType;
return path.extname(migration.filename).replace(/^\./, '');
}

function parseMigrationScript(migration, fileType) {
Expand Down
Loading

0 comments on commit 29bc13b

Please sign in to comment.