Skip to content

Commit dbff11d

Browse files
author
Tal Almagor
committed
Update README.md
1 parent 4c473dd commit dbff11d

File tree

1 file changed

+49
-9
lines changed

1 file changed

+49
-9
lines changed

README.md

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
# node-mysql-migrate
22

3+
## Table of Contents
4+
5+
- [Overview](#overview)
6+
- [Installation](#installation)
7+
- [Command line](#command-line)
8+
- [baseline](#baseline)
9+
- [info](#info)
10+
- [migrate](#migrate)
11+
- [repair](#repair)
12+
- [clean](#clean)
13+
- [Writing a migration script](#writing-a-migration-script)
14+
- [Data Directory](#data-directory)
15+
- [Naming](#naming)
16+
- [SQL](#sql)
17+
- [Node.js](#nodejs)
18+
- [Using the library](#using-the-library-directly)
19+
- [Configuration](#configuration)
20+
21+
322
## Overview
4-
Simple migration tool for Mysql/Node.js
523

6-
# Quick Start
24+
Simple MySQL migration tool written in Node.js. MIT License.
25+
26+
## Quick Start
727

8-
#### Install
28+
#### Installation
929

1030
```sh
1131
npm install -g https://github.com/talmago/node-mysql-migrate
1232
```
1333

14-
After the installation, you can start using the command line as well as the library.
15-
34+
> **NOTICE:** -g flag is mandatory if you wish to use the command line.
35+
Use `npm install https://github.com/talmago/node-mysql-migrate` if you want to use the library.
1636

1737
#### Command line
1838

@@ -238,7 +258,7 @@ Examples:
238258
239259
###### SQL
240260
241-
Writing migration script in SQL is pretty straight-forward, as it used the standard
261+
Writing migration script in SQL is pretty straight-forward, as it uses the standard
242262
MySQL programming (http://dev.mysql.com/doc/refman/5.7/en/sql-syntax.html). Below is
243263
a simple example which created a new table in our project called `users`.
244264
@@ -276,6 +296,27 @@ module.exports = function(connection) {
276296
Node.js modules should not start or end a new transaction, as these operations are expected to raise
277297
runtime errors as well.
278298
299+
#### Using the library directly
300+
301+
```javascript
302+
303+
var SchemaManager = require('node-mysql-migrate').SchemaManager;
304+
305+
var mgr = new SchemaManager('myproject', {
306+
.. config ..
307+
});
308+
309+
mgr.migrate('/path/to/data/directory')
310+
.then(function() {
311+
// .. post-migration code ..
312+
})
313+
.catch(function(e) {
314+
console.error(e.message);
315+
})
316+
.finally(function() {
317+
mgr.close();
318+
})
319+
```
279320
280321
#### Configuration
281322
@@ -295,7 +336,7 @@ Configuration should be in one of the following formats:
295336
* INI
296337
* JSON
297338
298-
## INI (example)
339+
###### INI
299340
300341
```
301342
[logging]
@@ -312,8 +353,7 @@ schema = myproject
312353
datadir = /etc/mysql-migraterc/data
313354
```
314355
315-
316-
## JSON (example)
356+
###### JSON
317357
318358
```javascript
319359
{

0 commit comments

Comments
 (0)