about summary refs log tree commit diff
path: root/db/migrate/20190715164535_add_instance_actor.rb
blob: 8c0301d69d8bf3ec1fd7c15634bb37f51a0a14b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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 }
  end

  def up
    Account.create!(id: -99, actor_type: 'Application', locked: true, username: Rails.configuration.x.local_domain)
  end

  def down
    Account.find_by(id: -99, actor_type: 'Application').destroy!
  end
end