6bc2fd1048
After converting base 16 (hex) string of length 16 to integer and then to base 36 we can end up with a shorter string due to implicit zeroes on leading positions in the intermediate integer. This ensures "00000000000000000000000000000000", "ffffffffffffffffffffffffffffffff" and everything in between result in a string of length 25 after converting to base 36.
12 lines
330 B
Ruby
12 lines
330 B
Ruby
class AddSecretTokenToAsciicasts < ActiveRecord::Migration
|
|
def change
|
|
add_column :asciicasts, :secret_token, :string
|
|
|
|
Asciicast.find_each do |asciicast|
|
|
asciicast.update_attribute(:secret_token, Asciicast.generate_secret_token)
|
|
end
|
|
|
|
change_column :asciicasts, :secret_token, :string, null: false
|
|
end
|
|
end
|