5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 18:36:22 +00:00
panel/db/migrate/20201207152354_add_api_key_to_sites.rb

17 lines
335 B
Ruby
Raw Normal View History

class AddApiKeyToSites < ActiveRecord::Migration[6.0]
def up
add_column :sites, :api_key_ciphertext, :string
begin
Site.find_each do |site|
site.update_attribute :api_key, SecureRandom.hex(64)
end
rescue Errno::ENOENT
end
end
def down
remove_column :sites, :api_key_ciphertext
end
end