Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@ node_js: '6'
sudo: required
dist: trusty
addons:
firefox: 52.3.0
postgresql: '9.4'
firefox: latest
install:
- npm install
- npm install
before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- psql -c 'create database bitballs;' -U postgres
- 'export DISPLAY=:99.0'
- sh -e /etc/init.d/xvfb start
script:
- sudo sh -c 'dbus-uuidgen > /etc/machine-id'
- sudo sh -c 'dbus-uuidgen > /etc/machine-id'
before_deploy:
- git config --global user.email "[email protected]"
- git config --global user.name "bitballs deploy bot"
- node public/build
- git add public/dist/ --force
- git commit -m "Updating build."
- node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN"
- git config --global user.email "[email protected]"
- git config --global user.name "bitballs deploy bot"
- node public/build
- git add public/dist/ --force
- git commit -m "Updating build."
- node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN"
deploy:
skip_cleanup: true
provider: heroku
Expand All @@ -28,4 +26,4 @@ deploy:
secure: "eQg48vbV7bfZ86eJ+e9oTt8hU18zS6frECUOr+v4J8paLEnBhSaKYnAAQolhAiS+aWfs9ZwAuvSbGtyKoDiTfdtlIfemFqufTRWVHVMJUUEcRpgTPZ8ooq1vkIMdVQUXEEnu1bO9cnLBJzxbDw84qOsFE7bNUyUeT0a6gnrGMleL0FRXNy9qNU5MO1DaQhOOA5JyOt666+W26bRyDnVnNNMrrB6fv4dY2M9oR40EYiQ0WcrzuXxSgpm/WHU+DPSfw/2rqbq0leOjpMZCJZh4XDTc02P9X31YgKAJhChI4OApdZbEpunbH7U2qu7VzN8pYxl0YqKM7/8he4IjO5bG+92Y1daVwmJ4gV0YjIrVrDaBs+n0El47ktY19IEuOBxkbDXJ9yNnREy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W+dxV52O4QaGKZJsBbiNGCod+PdtcQFy+MNiIfM1fdLVEQcjctPi/DF4ugqHoq/0ShPQJXevVD4MFmB4ph3nCyH2zjPnokWWpFIDXTyyIHQyXq9ol9cFmHBkYdAYHd5Lo9NKpbHIjx2Fzb9qiFJq26MMBomgZT1l884TS9c9bwQHumzjJy0GZEyhNE/AReycNTEo33CkcD/OAQ7arNsU2c2/yVHVUcXUJSmIGDDbL/OC1/9tjTB/TWjMrkyxvv/5omO5pQpcdM0ed1aGjH2EBUhWlyjY5zivsyr3NlbYfeG/aLsjns6N0VDpcGtqRlvYhg2DQkjbTW4BIoDSBrxTM5k+ERnrRinI46FzPHObFt4i74o4TGlEsWTKLKnKxUhVWpfyiD2XItE7yF+Ol+guelvlYTNK/2J62aVURN5LZWKtsS98JeEOJS4TXt3d/osFxyBOFwIU/AHp09bg6sOTfaj6gZkz2n81TaezVwWR6Ly55AsACqbAWmSKO0X72OEGWDeT0kQ4CyrYV9XRRqzBpQB0EftBxAgLaUPilT7UMH7W8iU2zu06s931+KNSDdB4aUJuuSwpETWz1oQjo=
6 changes: 5 additions & 1 deletion database.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"dev": "postgres://localhost:5432/bitballs",
"dev": {
"driver": "sqlite3",
"filename": "sqlite.db"
},
"test": "postgres://localhost:5432/bitballs",
"prod": {
"ENV": "DATABASE_URL",
"driver": "pg"
Expand Down
2 changes: 1 addition & 1 deletion migrations/20150801045523-players.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exports.up = function(db, callback) {
db.createTable('players', {
id: { type: 'int', primaryKey: true, autoIncrement: true },
name: 'string',
name: { type: 'string', notNull: true },
weight: 'int',
height: 'int',
birthday: 'date',
Expand Down
9 changes: 5 additions & 4 deletions migrations/20150804053921-add-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports.up = function(db, callback) {
async.series([
db.createTable.bind(db, 'tournaments', {
id: { type: 'int', primaryKey: true, autoIncrement: true },
date: 'date'
date: { type: 'date', notNull: true },
}),
db.createTable.bind(db, 'teams', {
id: { type: 'int', primaryKey: true, autoIncrement: true },
Expand All @@ -22,13 +22,15 @@ exports.up = function(db, callback) {
round: 'string',
court: 'string',
videoUrl: 'string',
homeTeamId: 'string',
awayTeamId: 'string'
homeTeamId: 'int',
awayTeamId: 'int'
}),
db.createTable.bind(db, 'stats', {
id: { type: 'int', primaryKey: true, autoIncrement: true },
gameId: 'int',
playerId: 'int',
time: { type: 'int' },
value: {type: 'int'},
type: 'string'
})
], callback);
Expand All @@ -42,4 +44,3 @@ exports.down = function(db, callback) {
db.dropTable.bind(db, 'stats')
], callback);
};

15 changes: 0 additions & 15 deletions migrations/20150809023413-add-stats-time.js

This file was deleted.

11 changes: 10 additions & 1 deletion migrations/20150816063154-add-users.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ exports.up = function(db, callback) {
db.createTable('users', {
id: { type: 'int', primaryKey: true, autoIncrement: true },
name: 'string',
password: 'string',
password: { type: 'string', notNull: true },
email: {type: 'string', unique: true},
verificationHash: {
type: "string",
length: 100
},
verified: {
type: "boolean",
notNull: true,
defaultValue: false
},
isAdmin: 'boolean'
}, callback);
};
Expand Down
31 changes: 0 additions & 31 deletions migrations/20160301185116-required-fields.js

This file was deleted.

24 changes: 0 additions & 24 deletions migrations/20160307152540-validate-emails.js

This file was deleted.

21 changes: 0 additions & 21 deletions migrations/20160313205522-team-ints.js

This file was deleted.

12 changes: 11 additions & 1 deletion models/bookshelf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,18 @@ var connectionString = typeof dbEnvironmentConfig === 'string' ?
dbEnvironmentConfig :
process.env[dbEnvironmentConfig.ENV];

if (typeof dbEnvironmentConfig.filename === 'string') {
connectionString = {
filename: dbEnvironmentConfig.filename
};
// Creates the database if needed
var driver = require(dbEnvironmentConfig.driver).verbose();
new driver.Database(dbEnvironmentConfig.filename);
}


var knex = require('knex')({
client: 'pg',
client: dbEnvironmentConfig.driver,
connection: connectionString
});

Expand Down