Here's an example of a rails migration which modifies application configuration:
require 'fusionauth/fusionauth_client' class ModifyApplicationToUseForm < ActiveRecord::Migration[6.1] def up client = FusionAuth::FusionAuthClient.new(ENV['FA_API_KEY'], Rails.configuration.x.oauth.idp_url) request = { "application": { "registrationConfiguration": { "enabled": true, "type": "basic" } } } res = client.patch_application(Rails.configuration.x.oauth.client_id, request) if res.status != 200 raise "did not succeed." end end def down client = FusionAuth::FusionAuthClient.new(ENV['FA_API_KEY'], Rails.configuration.x.oauth.idp_url) request = { "application": { "registrationConfiguration": { "enabled": false } } } res = client.patch_application(Rails.configuration.x.oauth.client_id, request) if res.status != 200 raise "did not succeed." end end endWorth noting that I pull the API key from the environment and the location of the FusionAuth instance and the application id from a config file. Often you'll need to do a lookup if you are modifying other entities.
You'd run this via the normal migration process: rails db:migrate to roll forward and rails db:rollback to rollback.
You can also run more than one operation in a single migration, but there's no transaction surrounding these changes, so if you are making three changes and step number 2 fails, you'll have to back out step number manually.