<commit_before>Sequel.migration do
  up do
    alter_table(:permissions) do
      drop_column :entity_id
      drop_column :entity_type
    end
  end

  down do
    alter_table(:permissions) do
      add_column :entity_id, :uuid
      add_column :entity_type, :text
    end
    Rails::Sequel.connection.run(%{
      UPDATE permissions SET entity_id = visualizations.id, entity_type = 'vis'
      FROM visualizations
      WHERE permissions.id = visualizations.permission_id })
    Rails::Sequel.connection.run('DELETE FROM permissions WHERE entity_id IS NULL')
    alter_table(:permissions) do
      set_column_not_null(:entity_id)
      set_column_not_null(:entity_type)
    end
  end
end<commit_msg>Don't add NOT NULL constraints, the old schema didn't have them.<commit_after>Sequel.migration do
  up do
    alter_table(:permissions) do
      drop_column :entity_id
      drop_column :entity_type
    end
  end

  down do
    alter_table(:permissions) do
      add_column :entity_id, :uuid
      add_column :entity_type, :text
    end
    Rails::Sequel.connection.run(%{
      UPDATE permissions SET entity_id = visualizations.id, entity_type = 'vis'
      FROM visualizations
      WHERE permissions.id = visualizations.permission_id })
  end
end
{'fraction_non_alphanumeric': 0.0744, 'fraction_numerical': 0.0, 'mean_word_length': 3.374125874125874, 'pattern_counts': {'":': 0, '<': 3, '<?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': '934318', 'n_tokens_mistral': 387, 'n_tokens_neox': 378, 'n_words': 97}