mirror of
https://0xacab.org/sutty/sutty
synced 2025-02-21 12:01:47 +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]
|
class AddTokenToRoles < ActiveRecord::Migration[6.1]
|
||||||
def change
|
def up
|
||||||
add_column :roles, :token, :text
|
add_column :roles, :token, :string
|
||||||
Rol.find_each { |m| m.update_column( :token, SecureRandom.hex(64) ) }
|
Rol.find_each do |m|
|
||||||
|
m.update_column( :token, SecureRandom.hex(64) )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_column :roles, :token
|
||||||
end
|
end
|
||||||
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