mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-17 04:36:23 +00:00
fix: change migration methods to add token to roles #13903
This commit is contained in:
parent
f2236bb305
commit
a098e1baa7
2 changed files with 9 additions and 9 deletions
|
@ -1,6 +1,12 @@
|
|||
class AddTokenToRoles < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :roles, :token, :text
|
||||
Rol.find_each { |m| m.update_column( :token, SecureRandom.hex(64) ) }
|
||||
def up
|
||||
add_column :roles, :token, :string
|
||||
Rol.find_each do |m|
|
||||
m.update_column( :token, SecureRandom.hex(64) )
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :roles, :token
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
class ChangeTokenName < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
rename_column :roles, :token, :token_cyphertext
|
||||
Rol.find_each { |m| m.update_column( :token_cyphertext, SecureRandom.hex(64) ) }
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue