Socket
Socket
Sign inDemoInstall

node-mini-migrations

Package Overview
Dependencies
1
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.1.0

test/migrations/1-create-table.js

7

CHANGELOG.md

@@ -7,2 +7,9 @@ # Changelog

## [2.1.0] - 2019-11-08
### Fixed
- Throw on error
### Added
- Test for errors
## [2.0.1] - 2019-11-07

@@ -9,0 +16,0 @@ ### Fixed

12

package.json
{
"name": "node-mini-migrations",
"version": "2.0.1",
"version": "2.1.0",
"description": "A very small, lightweight and flexible migrations library unconcerned with what database you use",

@@ -15,9 +15,9 @@ "main": "src/index.js",

"license": "GPL-3.0",
"dependencies": {
"commander": "^4.0.0"
},
"devDependencies": {
"tape": "^4.10.1",
"sqlite": "^3.0.3"
},
"dependencies": {
"commander": "^3.0.0"
"sqlite": "^3.0.3",
"tape": "^4.11.0"
}
}

@@ -19,4 +19,4 @@ module.exports = async ({ driver, migrations, logger }) => {

await driverInstance.setMigrationDown(migration.id)
} catch (err) {
logger(`Error tearing down ${migration.id}`, err)
} catch (error) {
logger(`Error tearing down ${migration.id}`, error)
}

@@ -23,0 +23,0 @@ } else {

@@ -19,4 +19,5 @@ module.exports = async ({ driver, migrations, logger }) => {

await driverInstance.setMigrationUp(migration.id)
} catch (err) {
logger(`Error bringing up ${migration.id}`, err)
} catch (error) {
logger(`Error bringing up ${migration.id}`, error)
throw error
}

@@ -23,0 +24,0 @@ }

@@ -18,3 +18,3 @@ const fs = require('fs')

await up(prepareRun('./example'))
await up(prepareRun('./test/migrations'))

@@ -30,2 +30,14 @@ t.ok(fs.existsSync('./test.sqlite'))

test('migrate examples up with error', async function (t) {
t.plan(1)
clean()
try {
await up(prepareRun('./test/migrationsWithError'))
} catch (error) {
t.ok(error.toString().includes('SQLITE_ERROR'))
}
})
test('migrate examples up, down', async function (t) {

@@ -36,4 +48,4 @@ t.plan(2)

await up(prepareRun('./example'))
await down(prepareRun('./example'))
await up(prepareRun('./test/migrations'))
await down(prepareRun('./test/migrations'))

@@ -53,5 +65,5 @@ const db = await sqlite.open('./test.sqlite')

await up(prepareRun('./example'))
await down(prepareRun('./example'))
await up(prepareRun('./example'))
await up(prepareRun('./test/migrations'))
await down(prepareRun('./test/migrations'))
await up(prepareRun('./test/migrations'))

@@ -58,0 +70,0 @@ t.ok(fs.existsSync('./test.sqlite'))

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc