-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
33 lines (29 loc) · 965 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* This project should give an insight in how a project might utilize the
* programable API.
*
* This assumes we have a simple web project, which should initialize the
* database by itself. There are further examples on how to control and use the
* API in the cli project. This is the straightforward usage of db-migrate.
*
* You may also find a better integrated version of this with custom configs
* and other supported features in the server.js example.
*/
// first require the package
var DBMigrate = require( 'db-migrate' );
// The next step is to get a new instance of DBMigrate
var dbmigrate = DBMigrate.getInstance(true);
// next we call the migrations
dbmigrate.reset( () => {
dbmigrate.up( 2, () => {
dbmigrate.down( 1, () => {
dbmigrate.up( () => {
dbmigrate.reset( () => {
dbmigrate.up( () => {
console.log( 'Here we go!' );
} );
} );
} );
} );
} );
});