mysql-migrate-cli
Advanced tools
Comparing version
@@ -11,5 +11,3 @@ const path = require('path'); | ||
const appliedMigrations = (await connection.query(`SELECT file FROM ${options.table};`)) | ||
.map(row => row.file) | ||
.reverse(); | ||
const appliedMigrations = (await connection.query(`SELECT file FROM ${options.table} ORDER BY 1 DESC`)).map(row => row.file); | ||
@@ -16,0 +14,0 @@ if (appliedMigrations.length === 0) { |
{ | ||
"name": "mysql-migrate-cli", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Migrations tool for MYSQL db", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -50,7 +50,9 @@ # mysql-migrate-cli | ||
module.exports = { | ||
up: '', | ||
down: '' | ||
up: 'ALTER TABLE my_cool_table ADD COLUMN super_column TEXT;', | ||
down: 'ALTER TABLE my_cool_table DROP COLUMN super_column;' | ||
} | ||
``` | ||
where `up` and `down` is plain SQL | ||
where `up` and `down` is plain SQL: | ||
- `up` section applies migration | ||
- `down` section revert migration | ||
@@ -57,0 +59,0 @@ ### In your `package.json` |
8700
1.61%77
2.67%11
-8.33%148
-1.33%