<commit_before>var pg = require('pg');
var bcrypt = require('bcrypt-nodejs');
var config = require('../config');

var createDBClient = function() {
  var client = new pg.Client(config.db.postgres);
  client.connect();
  return client;
};

var client = createDBClient();
client.on('error', function(err) {
  console.log('Sorry, your database didn\'t set up correctly ' + err);
});

var testUsername = config.test.user.username;
var testPassword = bcrypt.hashSync(config.test.password, bcrypt.genSaltSync(10));
var testSpending = config.test.user.spending;
var testCategories = config.test.user.categories;
var testId = config.test.user.id;
var finalQuery;
console.log('Creating tables...');
client.query('CREATE TABLE users (id serial primary key, username varchar(30) UNIQUE, password varchar(60));')
client.query('CREATE TABLE spending (id int, cost float, category varchar(20), location varchar(30), date varchar(20));');
client.query('CREATE TABLE categories (id int, category varchar(20));');
client.query('INSERT INTO users VALUES($1,$2,$3)',[testId, testUsername, testPassword]);

for (var i = 0; i < testSpending.length; i++) {
	var insert = testSpending[i];
	client.query('INSERT INTO spending VALUES($1,$2,$3,$4,$5)', [testId, insert.cost, insert.category, insert.location, insert.date]);
}

for (var i = 0; i < testCategories.length; i++) {
  var insertCategory = testCategories[i];
  var finalQuery = client.query('INSERT INTO categories VALUES($1, $2)', [testId, insertCategory]);
}

finalQuery.on('end', function() {
  console.log('Done!');
	client.end();
});
<commit_msg>Test to fix Travis<commit_after>var pg = require('pg');
var bcrypt = require('bcrypt-nodejs');
var config = require('../config');

var createDBClient = function() {
  var client = new pg.Client(config.db.postgres);
  client.connect();
  return client;
};

var client = createDBClient();
client.on('error', function(err) {
  console.log('Sorry, your database didn\'t set up correctly ' + err);
});

var testUsername = config.test.user.username;
var testPassword = bcrypt.hashSync(config.test.password, bcrypt.genSaltSync(10));
var testSpending = config.test.user.spending;
var testCategories = config.test.user.categories;
var testId = config.test.user.id;
var finalQuery;
console.log('Creating tables...');
client.query('CREATE TABLE users (id serial primary key, username varchar(30) UNIQUE, password varchar(60));')
client.query('CREATE TABLE spending (id int, cost float, category varchar(20), location varchar(30), date varchar(20));');
client.query('CREATE TABLE categories (id int, category varchar(20));');
client.query('INSERT INTO users VALUES($1,$2,$3)',[testId, testUsername, testPassword]);

for (var i = 0; i < testSpending.length; i++) {
	var insert = testSpending[i];
	finalQuery = client.query('INSERT INTO spending VALUES($1,$2,$3,$4,$5)', [testId, insert.cost, insert.category, insert.location, insert.date]);
}

// for (var i = 0; i < testCategories.length; i++) {
//   var insertCategory = testCategories[i];
//   var finalQuery = client.query('INSERT INTO categories VALUES($1, $2)', [testId, insertCategory]);
// }

finalQuery.on('end', function() {
  console.log('Done!');
	client.end();
});

{'fraction_non_alphanumeric': 0.1703125, 'fraction_numerical': 0.01625, 'mean_word_length': 5.66875, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7412000', 'n_tokens_mistral': 1028, 'n_tokens_neox': 974, 'n_words': 268}