Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-mini-migrations

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-mini-migrations - npm Package Compare versions

Comparing version 5.0.0 to 6.0.0

.github/workflows/test.yml

4

down.js

@@ -1,2 +0,2 @@

async function down (driver, migrations, logger, steps) {
export async function down (driver, migrations, logger, steps) {
logger = logger || (() => null);

@@ -36,2 +36,2 @@ steps = steps || 1;

module.exports = down;
export default down;

@@ -1,11 +0,13 @@

const path = require('path');
const fs = require('fs');
import path from 'path';
import fs from 'fs';
const getMigrationsFromDirectory = (dir) => {
export const getMigrationsFromDirectory = (dir) => {
dir = path.resolve(dir);
const migrations = fs.readdirSync(dir)
.filter(file => !['index.js'].includes(file))
.filter(file => file.endsWith('.js'))
.map(file => ({ id: file, ...require(path.join(dir, file)) }));
const migrations = Promise.all(
fs.readdirSync(dir)
.filter(file => !['index.js'].includes(file))
.filter(file => file.endsWith('.js'))
.map(async file => ({ id: file, ...await import(path.join(dir, file)) }))
);

@@ -15,2 +17,2 @@ return migrations;

module.exports = getMigrationsFromDirectory;
export default getMigrationsFromDirectory;

@@ -1,5 +0,3 @@

module.exports = {
up: require('./up'),
down: require('./down'),
getMigrationsFromDirectory: require('./getMigrationsFromDirectory')
};
export { up } from './up.js';
export { down } from './down.js';
export { getMigrationsFromDirectory } from './getMigrationsFromDirectory.js';
{
"name": "node-mini-migrations",
"version": "5.0.0",
"version": "6.0.0",
"type": "module",
"description": "A very small, lightweight and flexible migrations library unconcerned with what database you use",
"main": "index.js",
"scripts": {
"test": "node test"
"test": "c8 node test"
},
"author": "Mark Wylde",
"author": {
"name": "Mark Wylde",
"email": "me@markwylde.com",
"url": "https://github.com/markwylde"
},
"license": "MIT",
"dependencies": {
"righto-series": "^1.0.1"
"devDependencies": {
"basictap": "^3.4.3",
"c8": "^7.12.0",
"sqlite-fp": "^2.1.2"
},
"devDependencies": {
"righto-tape": "^1.0.4",
"sqlite-fp": "^2.0.0",
"tape": "^4.13.2"
}
"directories": {
"test": "test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/markwylde/node-mini-migrations.git"
},
"keywords": [],
"bugs": {
"url": "https://github.com/markwylde/node-mini-migrations/issues"
},
"homepage": "https://github.com/markwylde/node-mini-migrations#readme"
}
# Mini Migrations for NodeJS
[![Build Status](https://travis-ci.org/markwylde/node-mini-migrations.svg?branch=master)](https://travis-ci.org/markwylde/node-mini-migrations)
[![David DM](https://david-dm.org/markwylde/node-mini-migrations.svg)](https://david-dm.org/markwylde/node-mini-migrations)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/markwylde/node-mini-migrations)
[![GitHub package.json version](https://img.shields.io/github/package-json/v/markwylde/node-mini-migrations)](https://github.com/markwylde/node-mini-migrations/releases)
[![GitHub](https://img.shields.io/github/license/markwylde/node-mini-migrations)](https://github.com/markwylde/node-mini-migrations/blob/master/LICENSE)
A really simple node migrations library that is completely independent of any database or file system.
A really simple node migrations library that is completely independant of any database or file system.
## Installation

@@ -18,5 +12,5 @@ ```bash

```javascript
const sqlite = require('sqlite-fp/promises');
const up = require('node-mini-migrations/up');
const getMigrationsFromDirectory = require('node-mini-migrations/getMigrationsFromDirectory');
import sqlite from 'sqlite-fp/promises.js';
import up from 'node-mini-migrations/up.js';
import getMigrationsFromDirectory from 'node-mini-migrations/getMigrationsFromDirectory.js';

@@ -54,10 +48,8 @@ function migrator (db) {

```javascript
module.exports = {
up: (db) => {
return db.exec('CREATE TABLE test_table (test TEXT)')
},
export function up (db) {
return db.exec('CREATE TABLE test_table (test TEXT)')
}
down: (db) => {
return db.exec('DROP TABLE test_table')
}
export function down (db) {
return db.exec('DROP TABLE test_table')
}

@@ -64,0 +56,0 @@ ```

@@ -1,8 +0,8 @@

const fs = require('fs');
const test = require('righto-tape');
const sqlite = require('sqlite-fp/promises');
import fs from 'fs';
import test from 'basictap';
import sqlite from 'sqlite-fp/promises.js';
const migrator = require('./migrations');
import migrator from './migrations/index.js';
const { getMigrationsFromDirectory, down, up } = require('../');
import { getMigrationsFromDirectory, down, up } from '../index.js';

@@ -22,3 +22,3 @@ function clean () {

const driver = migrator(db);
const migrations = getMigrationsFromDirectory('./test/migrations');
const migrations = await getMigrationsFromDirectory('./test/migrations');
await up(driver, migrations, null);

@@ -40,3 +40,3 @@

const driver = migrator(db);
const migrations = getMigrationsFromDirectory('./test/migrations');
const migrations = await getMigrationsFromDirectory('./test/migrations');
await up(driver, migrations, null);

@@ -59,3 +59,3 @@ await down(driver, migrations, null, 1);

const driver = migrator(db);
const migrations = getMigrationsFromDirectory('./test/migrations');
const migrations = await getMigrationsFromDirectory('./test/migrations');
await up(driver, migrations, null);

@@ -80,3 +80,3 @@ await down(driver, migrations, null, 1);

const driver = migrator(db);
const migrations = getMigrationsFromDirectory('./test/migrationsError');
const migrations = await getMigrationsFromDirectory('./test/migrationsError');
await up(driver, migrations, null);

@@ -83,0 +83,0 @@ } catch (error) {

@@ -1,9 +0,7 @@

module.exports = {
up: (db) => {
return db.run('CREATE TABLE test_table (test TEXT)');
},
export function up (db) {
return db.run('CREATE TABLE test_table (test TEXT)');
}
down: (db) => {
return db.run('DROP TABLE test_table');
}
};
export function down (db) {
return db.run('DROP TABLE test_table');
}

@@ -1,9 +0,7 @@

module.exports = {
up: (db) => {
return db.run('INSERT INTO test_table (test) VALUES (?)', ['hello']);
},
export function up (db) {
return db.run('INSERT INTO test_table (test) VALUES (?)', ['hello']);
}
down: (db) => {
return db.run('DELETE FROM test_table WHERE test = ?', ['hello']);
}
};
export function down (db) {
return db.run('DELETE FROM test_table WHERE test = ?', ['hello']);
}

@@ -1,4 +0,4 @@

const sqlite = require('sqlite-fp/promises');
import sqlite from 'sqlite-fp/promises.js';
module.exports = function (db) {
export default function (db) {
const monad = {

@@ -29,2 +29,2 @@ run: (...args) => sqlite.run(db, ...args),

};
};
}

@@ -1,9 +0,7 @@

module.exports = {
up: (db) => {
return db.run('CREATE_WHOOPS TABLE test_table (test TEXT)');
},
export function up (db) {
return db.run('CREATE_WHOOPS TABLE test_table (test TEXT)');
}
down: (db) => {
return db.run('DROP TABLE test_table');
}
};
export function down (db) {
return db.run('DROP TABLE test_table');
}

@@ -1,9 +0,7 @@

module.exports = {
up: (db) => {
return db.run('INSERT INTO test_table (test) VALUES (?)', ['hello']);
},
export function up (db) {
return db.run('INSERT INTO test_table (test) VALUES (?)', ['hello']);
}
down: (db) => {
return db.run('DELETE FROM test_table WHERE test = ?', ['hello']);
}
};
export function down (db) {
return db.run('DELETE FROM test_table WHERE test = ?', ['hello']);
}

@@ -1,4 +0,4 @@

const sqlite = require('sqlite-fp/promises');
import sqlite from 'sqlite-fp/promises.js';
module.exports = function (db) {
export default function (db) {
const monad = {

@@ -29,2 +29,2 @@ run: (...args) => sqlite.run(db, ...args),

};
};
}

@@ -1,2 +0,2 @@

async function up (driver, migrations, logger) {
export async function up (driver, migrations, logger) {
logger = logger || (() => null);

@@ -26,2 +26,2 @@

module.exports = up;
export default up;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc