<commit_before>exports.up = (knex, Promise) => {
  return knex.schema.renameTable('files', 'bill_files')
    .then(() => {
      return knex.schema.createTable('expense_files', (table) => {
        table.increments('id').primary().notNullable()
        table.integer('expense_id').notNullable()
        table.text('path').notNullable()

        table.unique(['expense_id', 'path'])
      })
    })
}

exports.down = (knex, Promise) => {
  return knex.schema.renameTable('bill_files', 'files')
    .then(() => knex.schema.dropTableIfExists('expense_files'))
}
<commit_msg>added migration step to change file paths to new location<commit_after>exports.up = (knex, Promise) => {
  return knex.schema.renameTable('files', 'bill_files')
    .then(() => {
      return knex.schema.createTable('expense_files', (table) => {
        table.increments('id').primary().notNullable()
        table.integer('expense_id').notNullable()
        table.text('path').notNullable()

        table.unique(['expense_id', 'path'])
      })
    })
    .then(() => {
      console.log('Move bill file paths to new location')

      return knex('bill_files').select('*')
    })
    .then((billFiles) => {
      return Promise.all(
        billFiles.map(fixPath)
      )
    })
}

exports.down = (knex, Promise) => {
  return knex.schema.renameTable('bill_files', 'files')
    .then(() => knex.schema.dropTableIfExists('expense_files'))
}

function fixPath(bill) {
  let newPath = bill.path.replace('/billy/files/', '/billy/files/bills/')
  return 
}
{'fraction_non_alphanumeric': 0.18503937007874016, 'fraction_numerical': 0.0, 'mean_word_length': 3.357142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4883897', 'n_tokens_mistral': 501, 'n_tokens_neox': 492, 'n_words': 76}