diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-04-26 21:22:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-26 21:22:09 +0200 |
commit | 33cd80d69c1491ff70ce9191113763c76cb7e6b7 (patch) | |
tree | b55d22d4f0e260b601b70fc790f8e4c49f7da751 /db | |
parent | f47a9ddc9ffca22258ec9e4b12ca51db8cac1eac (diff) |
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
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20190715164535_add_instance_actor.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/db/migrate/20190715164535_add_instance_actor.rb b/db/migrate/20190715164535_add_instance_actor.rb index 8c0301d69..0ae53199a 100644 --- a/db/migrate/20190715164535_add_instance_actor.rb +++ b/db/migrate/20190715164535_add_instance_actor.rb @@ -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 |