Fix instance actor being incorrectly created when running migrations (#18109)
* Add migration test about instance actor key * Fix old migration * Work around incorrect database state
This commit is contained in:
parent
f47a9ddc9f
commit
33cd80d69c
4 changed files with 20 additions and 1 deletions
|
@ -2,6 +2,14 @@ class AddInstanceActor < ActiveRecord::Migration[5.2]
|
|||
class Account < ApplicationRecord
|
||||
# Dummy class, to make migration possible across version changes
|
||||
validates :username, uniqueness: { scope: :domain, case_sensitive: false }
|
||||
|
||||
before_create :generate_keys
|
||||
|
||||
def generate_keys
|
||||
keypair = OpenSSL::PKey::RSA.new(2048)
|
||||
self.private_key = keypair.to_pem
|
||||
self.public_key = keypair.public_key.to_pem
|
||||
end
|
||||
end
|
||||
|
||||
def up
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue