<commit_before>exports.up = function(knex, Promise) {
  return Promise.all([
    knex.schema.hasTable('notification_settings').then(exists => {
      if (!exists) {
        return knex.schema
          .createTable('notification_settings', table => {
            table.increments();
            table.integer('user_id').notNullable();
            table
              .foreign('user_id')
              .references('users.id')
              .onDelete('CASCADE');
            table.jsonb('settings').defaultsTo('{}');
            table.timestamps();
          })
          .then(() =>
            knex('users')
              .pluck('id')
              .then(ids =>
                ids.map(id =>
                  knex('notification_settings').insert({ user_id: id }),
                ),
              ),
          );
      }
      return null;
    }),
  ]);
};

exports.down = function(knex, Promise) {
  return Promise.all([knex.schema.dropTable('notification_settings')]);
};<commit_msg>fixed notification_settings migration<commit_after>exports.up = function(knex, Promise) {
  return Promise.all([
    knex.schema.hasTable('notification_settings').then(exists => {
      if (!exists) {
        return knex.schema
          .createTable('notification_settings', table => {
            table.increments();
            table.integer('user_id').notNullable();
            table
              .foreign('user_id')
              .references('users.id')
              .onDelete('CASCADE');
            table.jsonb('settings').defaultsTo('{}');
            table.timestamps();
          })
          .then(() =>
            knex('users')
              .pluck('id')
              .then(ids =>
                ids.map(id =>
                  knex('notification_settings')
                    .insert({ user_id: id })
                    .return(),
                ),
              ),
          );
      }
      return null;
    }),
  ]);
};

exports.down = function(knex, Promise) {
  return Promise.all([knex.schema.dropTable('notification_settings')]);
};
{'fraction_non_alphanumeric': 0.1529066927210552, 'fraction_numerical': 0.0, 'mean_word_length': 1.6122448979591837, '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': '1888938', 'n_tokens_mistral': 555, 'n_tokens_neox': 541, 'n_words': 74}