<commit_before>// native
const path = require('path')
const fs = require('fs')

// packages
const moment = require('moment')
const osHomedir = require('os-homedir')

// constants
const DB_FILE = '.moro-data.db'

// ours
const helpers = require('./utils/helpers.js')

const knex = require('knex')({
  dialect: 'sqlite3',
  connection: {
    filename: path.join(osHomedir(), DB_FILE)
  },
  useNullAsDefault: true
})

// just cut the connection so that cli exits
const destroyKnex = () => {
  knex.destroy()
}

const removeDatabase = () => {
  const databaseFile = path.join(osHomedir(), DB_FILE)
  fs.unlink(databaseFile, (err) => {
    if (err) {
      console.log('problem in deleting the file ', err)
    }
    console.log('database file deleted successfully')
    console.log('press ctrl-c to exit')
  })
}

// Create a table
const createTable = knex.schema.createTableIfNotExists('records', (table) => {
  table.increments('id')
  table.date('date')
  table.time('start')
  table.time('end')
  table.integer('breakDuration')
})
  .catch((e) => console.log('Errors in createTable', e))
<commit_msg>fix deleting database<commit_after>// native
const path = require('path')
const fs = require('fs')

// packages
const moment = require('moment')
const osHomedir = require('os-homedir')

// constants
const DB_FILE = '.moro-data.db'

// ours
const helpers = require('./utils/helpers.js')

const knex = require('knex')({
  dialect: 'sqlite3',
  connection: {
    filename: path.join(osHomedir(), DB_FILE)
  },
  useNullAsDefault: true
})

// just cut the connection so that cli exits
const destroyKnex = () => {
  knex.destroy()
}

const removeDatabase = () => {
  const databaseFile = path.join(osHomedir(), DB_FILE)
  // close any connections
  destroyKnex()

  // delete the database file
  fs.unlink(databaseFile, (err) => {
    if (err) {
      console.log('problem in deleting the file ', err)
    }
    console.log('database file deleted successfully')
    console.log('press ctrl - c to exit')
  })
}

// Create a table
const createTable = knex.schema.createTableIfNotExists('records', (table) => {
  table.increments('id')
  table.date('date')
  table.time('start')
  table.time('end')
  table.integer('breakDuration')
})
  .catch((e) => console.log('Errors in createTable', e))

{'fraction_non_alphanumeric': 0.16272965879265092, 'fraction_numerical': 0.0008748906386701663, 'mean_word_length': 3.8867521367521367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '5160617', 'n_tokens_mistral': 758, 'n_tokens_neox': 753, 'n_words': 183}