<commit_before>class CreateMicroposts < ActiveRecord::Migration
  def change
    create_table :microposts do |t|
      t.string :content
      # t.reference => t.string :user_id
      t.references :user, index: true, foreign_key: true

      t.timestamps null: false
    end
    add_index :microposts, [:user_id, :created_at]
  end
end<commit_msg>add note to clarify indexing 2 columns<commit_after>class CreateMicroposts < ActiveRecord::Migration
  def change
    create_table :microposts do |t|
      t.string :content
      # t.reference => t.string :user_id
      t.references :user, index: true, foreign_key: true

      t.timestamps null: false
    end
    # adds index on user_id and created_at columns since we expect to reverse the order of the microposts with a given user_id
    # By including both the user_id and created_at columns as an array,
    # we arrange for Rails to create a multiple key index,
    # which means that Active Record uses both keys at the same time.
    add_index :microposts, [:user_id, :created_at]
  end
end
{'fraction_non_alphanumeric': 0.06781279847182425, 'fraction_numerical': 0.0009551098376313276, 'mean_word_length': 3.403361344537815, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3217349', 'n_tokens_mistral': 327, 'n_tokens_neox': 321, 'n_words': 119}