-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* amended water volume * adds instance methods to deactivate and reactivate a ribot * responds with 404 when retrieving active ribot
- Loading branch information
Stefan Pearson
committed
May 20, 2016
1 parent
e83ce18
commit e837dea
Showing
25 changed files
with
225 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,6 @@ test/reports | |
# Development environment | ||
.env | ||
cookbooks | ||
|
||
# App | ||
data/jobs/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// External ependancies | ||
var Promise = require( 'bluebird' ), | ||
_ = require( 'lodash' ); | ||
|
||
|
||
// Dependencies | ||
var db = require( '../index' ), | ||
Ribot = require( '../../app/models/ribot' ); | ||
|
||
|
||
/** | ||
* Alters the table by adding the required column | ||
*/ | ||
var createColumn = function createColumn( trx ) { | ||
return trx.schema.table( 'ribot', function( table ) { | ||
table.boolean( 'is_active' ); | ||
} ); | ||
}; | ||
|
||
|
||
/** | ||
* Adds new default values to all the ribot entities in the database | ||
*/ | ||
var alterData = function alterData( trx ) { | ||
return Ribot.fetchAll( { transacting: trx } ) | ||
.then( function( ribots ) { | ||
return ribots.map( function( ribot ) { | ||
return ribot.save( { isActive: true }, { patch: true, transacting: trx } ); | ||
} ); | ||
} ); | ||
}; | ||
|
||
|
||
/** | ||
* Alters the table by adding the required column | ||
*/ | ||
var alterColumn = function alterColumn( trx ) { | ||
return trx.schema.raw( "ALTER TABLE ribot ALTER COLUMN is_active SET NOT NULL" ); | ||
}; | ||
|
||
|
||
// Migrate function | ||
var migrate = function migrate( trx ) { | ||
return Promise.all( [ createColumn( trx ), alterData( trx ), alterColumn( trx ) ] ); | ||
}; | ||
|
||
|
||
// Exports | ||
module.exports = migrate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,9 @@ var date = moment().format(), | |
var seedData = { | ||
|
||
ribot: [ | ||
{ id: uuids[ 0 ], first_name: 'Robert', last_name: 'Douglas', email: '[email protected]', date_of_birth: '1970-01-01', avatar: 'http://example.com/avatar.png', hex_color: '#C0FFEE', is_authenticated: true, created_date: date, updated_date: date }, | ||
{ id: uuids[ 1 ], first_name: 'Matt', last_name: 'Oakes', email: '[email protected]', date_of_birth: '1970-02-02', avatar: 'http://example.com/avatar2.png', hex_color: '#C0FFEE', is_authenticated: false, created_date: date, updated_date: date } | ||
{ id: uuids[ 0 ], first_name: 'Robert', last_name: 'Douglas', email: '[email protected]', date_of_birth: '1970-01-01', avatar: 'http://example.com/avatar.png', hex_color: '#C0FFEE', is_authenticated: true, is_active: true, created_date: date, updated_date: date }, | ||
{ id: uuids[ 1 ], first_name: 'Matt', last_name: 'Oakes', email: '[email protected]', date_of_birth: '1970-02-02', avatar: 'http://example.com/avatar2.png', hex_color: '#C0FFEE', is_authenticated: false, is_active: true, created_date: date, updated_date: date }, | ||
{ id: uuids[ 2 ], first_name: 'Olly', last_name: 'Thomas', email: '[email protected]', date_of_birth: '1970-03-03', avatar: 'http://example.com/avatar3.png', hex_color: '#C0FFEE', is_authenticated: true, is_active: false, created_date: date, updated_date: date } | ||
], | ||
|
||
access_token: [ | ||
|
Oops, something went wrong.