{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-postgresql/json-schema/microsoft-azure-postgresql-migration-resource-for-patch-schema.json",
  "title": "MigrationResourceForPatch",
  "description": "Migration.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-postgresql-migrations-api-openapi.yml#/components/schemas/MigrationResourceForPatch",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/MigrationPropertiesForPatch",
      "description": "Migration properties.",
      "x-ms-client-flatten": true
    },
    "tags": {
      "type": "object",
      "description": "Application-specific metadata in the form of key-value pairs.",
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "AdminCredentialsForPatch": {
      "type": "object",
      "description": "Credentials of administrator users for source and target servers.",
      "properties": {
        "sourceServerPassword": {
          "type": "string",
          "format": "password",
          "description": "Password for the user of the source server.",
          "x-ms-mutability": [
            "update"
          ],
          "x-ms-secret": true
        },
        "targetServerPassword": {
          "type": "string",
          "format": "password",
          "description": "Password for the user of the target server.",
          "x-ms-mutability": [
            "update"
          ],
          "x-ms-secret": true
        }
      }
    },
    "Cancel": {
      "type": "string",
      "description": "Indicates if cancel must be triggered for the entire migration.",
      "enum": [
        "True",
        "False"
      ],
      "x-ms-enum": {
        "name": "Cancel",
        "modelAsString": true,
        "values": [
          {
            "name": "True",
            "value": "True",
            "description": "Cancel must be triggered for the entire migration."
          },
          {
            "name": "False",
            "value": "False",
            "description": "Cancel must not be triggered for the entire migration."
          }
        ]
      }
    },
    "LogicalReplicationOnSourceServer": {
      "type": "string",
      "description": "Indicates whether to setup logical replication on source server, if needed.",
      "enum": [
        "True",
        "False"
      ],
      "x-ms-enum": {
        "name": "LogicalReplicationOnSourceServer",
        "modelAsString": true,
        "values": [
          {
            "name": "True",
            "value": "True",
            "description": "Logical replication will be set up on the source server."
          },
          {
            "name": "False",
            "value": "False",
            "description": "Logical replication will not be set up on the source server."
          }
        ]
      }
    },
    "MigrateRolesAndPermissions": {
      "type": "string",
      "description": "Indicates if roles and permissions must be migrated.",
      "enum": [
        "True",
        "False"
      ],
      "x-ms-enum": {
        "name": "MigrateRolesAndPermissions",
        "modelAsString": true,
        "values": [
          {
            "name": "True",
            "value": "True",
            "description": "Roles and permissions will be migrated."
          },
          {
            "name": "False",
            "value": "False",
            "description": "Roles and permissions will not be migrated."
          }
        ]
      }
    },
    "MigrationMode": {
      "type": "string",
      "description": "Mode used to perform the migration.",
      "enum": [
        "Offline",
        "Online"
      ],
      "x-ms-enum": {
        "name": "MigrationMode",
        "modelAsString": true,
        "values": [
          {
            "name": "Offline",
            "value": "Offline",
            "description": "Offline migration mode."
          },
          {
            "name": "Online",
            "value": "Online",
            "description": "Online migration mode."
          }
        ]
      }
    },
    "MigrationPropertiesForPatch": {
      "type": "object",
      "description": "Migration properties.",
      "properties": {
        "sourceDbServerResourceId": {
          "type": "string",
          "description": "Identifier of the source database server resource, when 'sourceType' is 'PostgreSQLSingleServer'. For other source types this must be set to ipaddress:port@username or hostname:port@username."
        },
        "sourceDbServerFullyQualifiedDomainName": {
          "type": "string",
          "description": "Fully qualified domain name (FQDN) or IP address of the source server. This property is optional. When provided, the migration service will always use it to connect to the source server."
        },
        "targetDbServerFullyQualifiedDomainName": {
          "type": "string",
          "description": "Fully qualified domain name (FQDN) or IP address of the target server. This property is optional. When provided, the migration service will always use it to connect to the target server."
        },
        "secretParameters": {
          "$ref": "#/$defs/MigrationSecretParametersForPatch",
          "description": "Migration secret parameters."
        },
        "dbsToMigrate": {
          "type": "array",
          "description": "Names of databases to migrate.",
          "maxItems": 50,
          "items": {
            "type": "string"
          }
        },
        "setupLogicalReplicationOnSourceDbIfNeeded": {
          "$ref": "#/$defs/LogicalReplicationOnSourceServer",
          "description": "Indicates whether to setup logical replication on source server, if needed."
        },
        "overwriteDbsInTarget": {
          "$ref": "#/$defs/OverwriteDatabasesOnTargetServer",
          "description": "Indicates if databases on the target server can be overwritten when already present. If set to 'False', when the migration workflow detects that the database already exists on the target server, it will wait for a confirmation."
        },
        "migrationWindowStartTimeInUtc": {
          "type": "string",
          "format": "date-time",
          "description": "Start time (UTC) for migration window."
        },
        "migrateRoles": {
          "$ref": "#/$defs/MigrateRolesAndPermissions",
          "description": "Indicates if roles and permissions must be migrated."
        },
        "startDataMigration": {
          "$ref": "#/$defs/StartDataMigration",
          "description": "Indicates if data migration must start right away."
        },
        "triggerCutover": {
          "$ref": "#/$defs/TriggerCutover",
          "description": "Indicates if cutover must be triggered for the entire migration."
        },
        "dbsToTriggerCutoverOn": {
          "type": "array",
          "description": "When you want to trigger cutover for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array.",
          "items": {
            "type": "string"
          }
        },
        "cancel": {
          "$ref": "#/$defs/Cancel",
          "description": "Indicates if cancel must be triggered for the entire migration."
        },
        "dbsToCancelMigrationOn": {
          "type": "array",
          "description": "When you want to trigger cancel for specific databases set 'triggerCutover' to 'True' and the names of the specific databases in this array.",
          "items": {
            "type": "string"
          }
        },
        "migrationMode": {
          "$ref": "#/$defs/MigrationMode",
          "description": "Mode used to perform the migration: Online or Offline."
        }
      }
    },
    "MigrationSecretParametersForPatch": {
      "type": "object",
      "description": "Migration secret parameters.",
      "properties": {
        "adminCredentials": {
          "$ref": "#/$defs/AdminCredentialsForPatch",
          "format": "password",
          "description": "Credentials of administrator users for source and target servers.",
          "x-ms-secret": true
        },
        "sourceServerUsername": {
          "type": "string",
          "description": "Gets or sets the name of the user for the source server. This user doesn't need to be an administrator.",
          "x-ms-mutability": [
            "update"
          ]
        },
        "targetServerUsername": {
          "type": "string",
          "description": "Gets or sets the name of the user for the target server. This user doesn't need to be an administrator.",
          "x-ms-mutability": [
            "update"
          ]
        }
      }
    },
    "OverwriteDatabasesOnTargetServer": {
      "type": "string",
      "description": "Indicates if databases on the target server can be overwritten when already present.",
      "enum": [
        "True",
        "False"
      ],
      "x-ms-enum": {
        "name": "OverwriteDatabasesOnTargetServer",
        "modelAsString": true,
        "values": [
          {
            "name": "True",
            "value": "True",
            "description": "Databases on the target server can be overwritten when already present."
          },
          {
            "name": "False",
            "value": "False",
            "description": "Databases on the target server cannot be overwritten when already present. When the migration workflow detects that the database already exists on the target server, it will wait for a confirmation."
          }
        ]
      }
    },
    "StartDataMigration": {
      "type": "string",
      "description": "Indicates if data migration must start right away.",
      "enum": [
        "True",
        "False"
      ],
      "x-ms-enum": {
        "name": "StartDataMigration",
        "modelAsString": true,
        "values": [
          {
            "name": "True",
            "value": "True",
            "description": "Data migration must start right away."
          },
          {
            "name": "False",
            "value": "False",
            "description": "Data migration must not start right away."
          }
        ]
      }
    },
    "TriggerCutover": {
      "type": "string",
      "description": "Indicates if cutover must be triggered for the entire migration.",
      "enum": [
        "True",
        "False"
      ],
      "x-ms-enum": {
        "name": "TriggerCutover",
        "modelAsString": true,
        "values": [
          {
            "name": "True",
            "value": "True",
            "description": "Cutover must be triggered for the entire migration."
          },
          {
            "name": "False",
            "value": "False",
            "description": "Cutover must not be triggered for the entire migration."
          }
        ]
      }
    }
  }
}