Skip to content
This repository was archived by the owner on Feb 6, 2019. It is now read-only.

Commit f5fce52

Browse files
committed
Knex configuration and migrations
1 parent e506c05 commit f5fce52

File tree

4 files changed

+36
-11
lines changed

4 files changed

+36
-11
lines changed

chill.db.example

-12 KB
Binary file not shown.

knexfile.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require('babel-register');
2+
3+
const config = require('./src/config/config');
4+
const dbConfig = config.resolve().db;
5+
6+
module.exports = Object.assign({}, dbConfig, {
7+
migrations: {
8+
directory: './src/migrations'
9+
}
10+
});
11+

src/knexfile.js

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Create status_logs table.
3+
*
4+
* @param {Object} knex
5+
* @return {Promise}
6+
*/
7+
export function up(knex) {
8+
return knex.schema.createTable('status_logs', table => {
9+
table.increments().primary();
10+
table.string('name').notNullable();
11+
table.string('status').notNullable();
12+
table.timestamp('created_at');
13+
table.timestamp('updated_at');
14+
});
15+
}
16+
17+
/**
18+
* Drop status_logs table.
19+
*
20+
* @param {Object} knex
21+
* @return {Promise}
22+
*/
23+
export function down(knex) {
24+
return knex.schema.dropTable('status_logs');
25+
}

0 commit comments

Comments
 (0)