---
title: "Bulk Convert Code Pro Macros to Native Code Snippets (Data Center)"
canonical: "https://support.appfire.com/space/SUPPORT/3429400724/Bulk%20Convert%20Code%20Pro%20Macros%20to%20Native%20Code%20Snippets%20(Data%20Center)"
format: markdown
---
This article provides a guide for bulk converting **Code Pro for Confluence** macros to native Confluence **Code Snippet** macros in a Data Center environment. This is particularly useful during cloud migrations where the Code Pro app is no longer used or supported.

## Summary

This guide outlines the SQL-based process to bulk replace the `code-pro` macro with the native `code` macro. It includes specific instructions for identifying affected pages and executing the conversion.

- **Scenario 1:** Static code stored directly within the macro body (Convertible).
- **Scenario 2:** Code pulled from external profiles (for example, GitHub) (Non-convertible).

> ⚠️ **Ensure that you test this conversion thoroughly in a testing environment before applying it in production, and make sure to take a full database backup beforehand.**

## Scenario 1: Static code stored within the macro body

This scenario applies when you write the code content directly inside the macro body on the Confluence page.

### Prerequisites

- **Backup:** Perform a full database backup before executing any updates.
- **Environment:** Test the conversion in a staging/development environment first.
- **Downtime:** Stop the Confluence server or all Data Center nodes before updating the database.

> ⚠️ **Before updating the DB, ensure proper backups, stop the Confluence server or DC nodes, and update.**

### Step 1: Identify pages using Code Pro

Use the following query to find all spaces and pages that contain the Code Pro macro.

```
SELECT DISTINCT s.spacekey, c.title
FROM content c
JOIN bodycontent bc ON c.contentid = bc.contentid
JOIN spaces s ON c.spaceid = s.spaceid
WHERE c.contenttype IN ('PAGE','BLOGPOST','COMMENT')
AND bc.body ILIKE '%ac:name="code-pro"%';
```

![image-20260213-103015.png](media://cc6262f5-7f2c-48b2-a664-e8d577568d8c)

### Step 2: Bulk convert macros

Execute the following update to replace the `code-pro` macro name with the native `code` macro name.

```
UPDATE bodycontent
SET body = replace(body,
                   'ac:name="code-pro"',
                   'ac:name="code"')
WHERE bodycontentid IN (
  SELECT bc.bodycontentid
  FROM content c
  JOIN bodycontent bc ON c.contentid = bc.contentid
  WHERE c.contenttype IN ('PAGE','BLOGPOST','COMMENT')
  AND bc.body ILIKE '%ac:name="code-pro"%'
);
```

![image-20260213-104220.png](media://f8d13620-76a0-49b3-b160-1431638be7f3)

### Step 3: Post-conversion tasks

1. **Restart Confluence:** Restart the instance to load the updated configurations.
2. **Re-index:** Perform a full re-index of the instance to ensure the new macro names are reflected in search and rendering.
3. **Verify:** Check the *Macro Usage* report to confirm that `code-pro` instances have been reduced and native `code` instances have increased.

## Scenario 2: External profile-based content

This scenario applies when you configure the Code Pro macro to pull content from external sources (for example, GitHub profiles).

### Limitations

- **Non-Convertible:** The native Confluence Code Snippet macro does not support external profile-based rendering.
- **Result:** If you convert these macros using the SQL method above, the macro is replaced, but it doesn't render any data because the native macro can't fetch the external content.

### Recommendation

For pages that use external profiles, manually migrate the content, or copy the external code directly into a native Code Snippet macro.