<commit_before>class DeviseCreateUsers < ActiveRecord::Migration
  def self.up
    # encrypting passwords and authentication related fields
    rename_column :users, "crypted_password", "encrypted_password"
    change_column :users, "encrypted_password", :string, :limit => 128, :default => "", :null => false
    rename_column :users, "salt", "password_salt"
    change_column :users, "password_salt", :string, :default => "", :null => false

    # confirmation related fields
    rename_column :users, "activation_code", "confirmation_token"
    rename_column :users, "activated_at", "confirmed_at"
    change_column :users, "confirmation_token", :string
    add_column    :users, "confirmation_sent_at", :datetime

    # reset password related fields
    add_column :users, "reset_password_token", :string

    # rememberme related fields
    add_column :users, "remember_created_at", :datetime #additional field required for devise.
  end

  def self.down
    # rememberme related fields
    remove_column :users, "remember_created_at"

    # reset password related fields
    remove_column :users, "reset_password_token"

    # confirmation related fields
    rename_column :users, "confirmation_token", "activation_code"
    rename_column :users, "confirmed_at", "activated_at"
    change_column :users, "activation_code", :string
    remove_column :users, "confirmation_sent_at"

    # encrypting passwords and authentication related fields
    rename_column :users, "encrypted_password", "crypted_password"
    change_column :users, "crypted_password", :string, :limit => 40
    rename_column :users, "password_salt", "salt" 
    change_column :users, "salt", :string, :limit => 40
  end
end<commit_msg>Ensure upgrade devise users can continue logging in<commit_after>class DeviseCreateUsers < ActiveRecord::Migration
  def self.up
    # encrypting passwords and authentication related fields
    rename_column :users, "crypted_password", "encrypted_password"
    change_column :users, "encrypted_password", :string, :limit => 128, :default => "", :null => false
    rename_column :users, "salt", "password_salt"
    change_column :users, "password_salt", :string, :default => "", :null => false

    # confirmation related fields
    rename_column :users, "activation_code", "confirmation_token"
    rename_column :users, "activated_at", "confirmed_at"
    change_column :users, "confirmation_token", :string
    add_column    :users, "confirmation_sent_at", :datetime

    # reset password related fields
    add_column :users, "reset_password_token", :string

    # rememberme related fields
    add_column :users, "remember_created_at", :datetime #additional field required for devise.

    # Current users can carry on logging in
    User.all.each(&:confirm!)
  end

  def self.down
    # rememberme related fields
    remove_column :users, "remember_created_at"

    # reset password related fields
    remove_column :users, "reset_password_token"

    # confirmation related fields
    rename_column :users, "confirmation_token", "activation_code"
    rename_column :users, "confirmed_at", "activated_at"
    change_column :users, "activation_code", :string
    remove_column :users, "confirmation_sent_at"

    # encrypting passwords and authentication related fields
    rename_column :users, "encrypted_password", "crypted_password"
    change_column :users, "crypted_password", :string, :limit => 40
    rename_column :users, "password_salt", "salt" 
    change_column :users, "salt", :string, :limit => 40
  end
end
{'fraction_non_alphanumeric': 0.09957567185289957, 'fraction_numerical': 0.0039603960396039604, 'mean_word_length': 4.8737541528239205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '5519268', 'n_tokens_mistral': 1068, 'n_tokens_neox': 996, 'n_words': 286}