
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
node-mini-migrations
Advanced tools
A very small, lightweight and flexible migrations library unconcerned with what database you use
A really simple node migrations library that is completely independent of any database or file system.
npm install --save node-mini-migrations
import sqlite from 'sqlite-fp/promises.js';
import up from 'node-mini-migrations/up.js';
import getMigrationsFromDirectory from 'node-mini-migrations/getMigrationsFromDirectory.js';
function migrator (db) {
return {
init: (direction) => {
return sqlite.run(db, 'CREATE TABLE IF NOT EXISTS _migrations (file TEXT PRIMARY KEY);');
},
getMigrationState: (id) => {
return sqlite.getOne(db, 'SELECT file FROM _migrations WHERE file = ?', [id]);
},
setMigrationUp: (id) => {
return sqlite.run(db, 'INSERT INTO _migrations (file) VALUES (?)', [id]);
},
setMigrationDown: (id) => {
return sqlite.run(db, 'DELETE FROM _migrations WHERE file = ?', [id]);
},
handler: (fn) => fn(db)
};
};
const db = await sqlite.connect('./test.sqlite');
await up(
migrator(db),
getMigrationsFromDirectory('./test/migrations')
);
export function up (db) {
return db.exec('CREATE TABLE test_table (test TEXT)')
}
export function down (db) {
return db.exec('DROP TABLE test_table')
}
This project is licensed under the terms of the MIT license.
FAQs
A very small, lightweight and flexible migrations library unconcerned with what database you use
The npm package node-mini-migrations receives a total of 9 weekly downloads. As such, node-mini-migrations popularity was classified as not popular.
We found that node-mini-migrations demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.