Database Migration Service integrates Gemini for Google Cloud into the conversion workspaces to help you speed up and improve the conversion process in the following areas:
-
Enhance the deterministic conversion results with Gemini-powered auto-conversion to use the power of AI to significantly reduce the number of manual adjustments needed in your PostgreSQL code.
This feature is supported only for upgraded conversion workspaces. Only freshly created workspaces can be upgraded. For more information, see Upgrade a conversion workspace.
- Provide code explainability features with the conversion assistant: a set of dedicated prompts that can help you better understand the conversion logic, propose fixes for conversion issues, or optimize converted code.
-
Expedite applying fixes for conversion issues with Gemini code conversion suggestions: a mechanism where the Gemini model can learn as you fix conversion issues and suggest changes to other faulty objects in the workspace.
You can also combine this feature with code explainability for a complete, end-to-end Gemini-powered code object conversion experience. For more information, see Example workflow for fixing code objects with conversion issues.
Your SQL code and schema are stored in the region where you create the conversion workspace. If you use assisted code and schema conversion with Gemini models, your code and schemas might be processed in other regions.
Learn how and when Gemini for Google Cloud uses your data.
Costs
To use Gemini assistance in Database Migration Service conversion workspaces you need to enable Gemini for Google Cloud API. Pricing for Gemini applies. For more information, see Gemini for Google Cloud pricing.
Before you begin
To use Gemini-powered features in Database Migration Service, do the following:
Enable Gemini for Google Cloud in your project.
-
After you enable Gemini for Google Cloud in your project, Conversion assistant and pattern matching are automatically enabled for all the conversion workspaces in your project. To use auto-conversion, you need to enable it on a per-workspace basis.
Enabling or disabling each Gemini-powered feature also depends on whether you use an upgraded conversion workspace. For more information on enabling or disabling each feature, see next sections on this page.
Use Gemini auto-conversion
When you convert your source schema, Database Migration Service uses the deterministic conversion rules to create the PostgreSQL syntax equivalents. Auto-conversion integrates Gemini-powered corrections on top of the deterministic results to reduce the number of conversion issues and improve conversion quality.
To use auto-conversion, do the following:
- Create a new conversion workspace. Make sure you immediately upgrade it to use the latest streamlined experience.
- Go to Conversion workspaces and select your workspace.
- Enable auto-conversion for your workspace.
- Convert your source code and schema. Click
Database Migration Service automatically employs Gemini-powered enhancements in the conversion. You can use the tree view to see which objects are augmented with Gemini:
Figure 1. Source schema tree view with Gemini augmentation status. (click to enlarge)
Convert source.
In the tree view, select any augmented object to view the details of enhancements provided by auto-conversion. If you don't like the changes introduced by Gemini, click Use deterministic code instead to revert the object to the deterministic conversion results.
Figure 2. Gemini-powered auto-conversion panel where you can inspect the details of code and schema augmentations. (click to enlarge)
Enable auto-conversion
If you previously disabled auto-conversion, you can enable it in the Gemini panel:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- Click pen_spark Gemini.
Gemini side panel opens.
- Select the Auto-conversion checkbox, and click Save settings.
Your conversion workspace will now auto-conversion when you convert your schema.
- Optional: In the Convert source objects with Gemini? dialog,
click Convert.
Your converted objects aren't modified when you enable auto-conversion. You can convert your schema again at a later time.
Disable auto-conversion
To disable auto-conversion, do the following:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- Click pen_spark Gemini.
Gemini side panel opens.
- Clear the Auto-conversion checkbox, and click Save settings.
Your conversion workspace will now use deterministic code and schema conversion when you convert your schema.
- Optional: In the Convert source objects? dialog, click
Convert.
Your converted objects aren't modified when you disable auto-conversion. You can convert your schema again at a later time if you want to revert the conversion results to use deterministic conversion rules.
Use Gemini conversion assistant
The conversion assistant is a set of dedicated prompts that you can use to gain a better understanding of the object conversion logic, ask for ideas on how to optimize code and remedy your conversion issues, or even add comments to your schema for self-documenting database objects.


Enable conversion assistant
Conversion assistant is enabled by default when you enable the Gemini for Google Cloud in your project. If you previously disabled the conversion assistant, you can enable it again in your workspace. The steps to enable the conversion assistant are different depending on whether you use an upgraded conversion workspace or not.
Upgraded workspaces
To enable conversion assistant in the upgraded conversion workspaces, do the following:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- Click pen_spark Gemini.
Gemini side panel opens.
- Select the Conversion assistance checkbox, and click Save settings.
Non-upgraded workspaces
For older workspaces that aren't upgraded to use Gemini auto-conversion, conversion assistance is enabled by default after you enable Gemini for your project. You don't need to perform any additional steps.
Disable conversion assistant
The steps to enable the conversion assistant are different depending on whether you use an upgraded conversion workspace or not.
Upgraded workspaces
To enable conversion assistant in upgraded conversion workspaces, do the following:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- Click pen_spark Gemini.
Gemini side panel opens.
- Select the Conversion assistance checkbox, and click Save settings.
Non-upgraded workspaces
For older workspaces that aren't upgraded to use Gemini auto-conversion, conversion assistance is enabled by default after you enable Gemini for your project.
You can disable the conversion assistant if you disable the Gemini for Google Cloud in your project.
Help me fix object conversion issues
The rule-based code and schema conversion engine might sometimes encounter issues when translating objects from SQL Server to PostgreSQL. For example, certain SQL Server functions might not have direct equivalents in PostgreSQL. You can use the Help me fix object conversion issues prompt to get a proposal of code changes that can fix the conversion issue.
This prompt is only available for editable code objects that have conversion issues. You can't view this prompt for other types of objects in the conversion workspace.
To use this prompt, do the following:
In the Google Cloud console, go to Conversion workspaces.
From the list of available conversion workspaces, select the conversion workspace that you want to work with.
The conversion workspace editor opens.
In the SQL Server panel, select one of your SQL Server objects.
In the object details view, select Conversion assistant > Help me fix object conversion issues.
A pane with prompt results opens.
Verify the diff screen that shows proposed improvements. If you like the results, you can use the Insert suggestion button to update the converted object.
Repeat the steps for every faulty code object. As you apply the code proposals, Gemini models learn the pattern and can offer suggestions on how to propagate the fixes to all faulty objects in your workspace.
Explain the conversion logic for this object
With the Explain the conversion logic for this object prompt, you can get a step-by-step explanation of what the converted code does, including a summary of best practices applied in the new code.
To request an explanation of the object conversion logic, do the following:
In the Google Cloud console, go to Conversion workspaces.
From the list of available conversion workspaces, select the conversion workspace that you want to work with.
The conversion workspace editor opens.
In the SQL Server panel, select one of your SQL Server objects.
In the object details view, select Conversion assistant > Explain the conversion logic for this object.
A pane with prompt results opens.
Help me optimize this code
Sometimes the results of rule-based code and schema conversion can be technically correct, but not fully optimized for PostgreSQL environments. You can use the Help me optimize this code prompt to get a proposal with code optimizations for your database object.
To use this prompt, do the following:
In the Google Cloud console, go to Conversion workspaces.
From the list of available conversion workspaces, select the conversion workspace that you want to work with.
The conversion workspace editor opens.
In the SQL Server panel, select one of your SQL Server objects.
In the object details view, select Conversion assistant > Help me optimize this code.
A pane with prompt results opens.
In the results panel, read the explanation, review the code, and make sure proposal is in line with what you need. If you like the results, you can use the Insert suggestion button to update the converted object.
Add comments to explain the purpose of this object
The Add comments to explain the purpose of this object prompt produces a proposal for code comments that you can add to your database object for self-documenting schema.
To use this prompt, do the following:
In the Google Cloud console, go to Conversion workspaces.
From the list of available conversion workspaces, select the conversion workspace that you want to work with.
The conversion workspace editor opens.
In the SQL Server panel, select one of your SQL Server objects.
In the object details view, select Conversion assistant > Add comments to explain the purpose of this object.
A pane with prompt results opens.
In the results panel, read the explanation, review the code, and make sure proposal is in line with what you need. If you like the results, you can use the Insert suggestion button to update the converted object.
Propagate conversion issue fixes with Gemini code conversion
When you fix conversion issues in your workspace, Gemini models can learn from your fixes and suggest changes to other faulty objects in the workspace. This way you can propagate your fixes to multiple objects without making all edits manually.
Enable Gemini conversion suggestions
Conversion suggestions are enabled by default when you enable the Gemini for Google Cloud in your project. If you previously disabled this feature, you can enable it again in your workspace. The steps to enable the conversion suggestions are different depending on whether you use an upgraded conversion workspace or not.
Upgraded workspaces
To enable conversion assistant in upgraded conversion workspaces, do the following:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- Click pen_spark Gemini.
Gemini side panel opens.
- Select the Pattern matching checkbox, and click Save settings.
Non-upgraded workspaces
For older workspaces that aren't upgraded to use Gemini auto-conversion, conversion suggestions are enabled by default after you enable Gemini for your project. If previously you disabled conversion suggestions, do the following to enable them again:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- In the taskbar, click pen_spark
Gemini and select Code suggestion.
Gemini code conversion suggestions are now enabled for this conversion workspace.
Disable Gemini conversion suggestions
The steps to enable the conversion assistant are different depending on whether you use an upgraded conversion workspace or not.
Upgraded workspaces
To enable conversion suggestions in upgraded conversion workspaces, do the following:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- Click pen_spark Gemini.
Gemini side panel opens.
- Clear the Pattern matching checkbox, and click Save settings.
Non-upgraded workspaces
To disable conversion suggestions for older workspaces that aren't upgraded to use Gemini auto-conversion, do the following:
- In the Google Cloud console, go to Conversion workspaces and select your workspace.
- In the taskbar, click pen_spark
Gemini and select Code suggestion.
Gemini code conversion suggestions are now disabled for this conversion workspace.
View Gemini conversion suggestions in Database Migration Service
When you fix object issues (by editing the SQL object's code or applying the code proposed by the Help me fix object conversion issues prompt), Gemini models analyze your changes. After enough changes are made, Gemini integration displays a prompt and suggests further edits.
To access Gemini suggestions:
From the list of available conversion workspaces, select the conversion workspace that you want to work with.
The conversion workspace editor opens.
In the SQL Server panel, select the object whose generated SQL you want to adjust.
Fix conversion issues that you encounter with the object and save code changes. You can edit the code manually, or use the Help me fix object conversion issues prompt.
Gemini models analyze your most recent fixes until it can suggest similar updates to other objects with conversion issues. When Gemini models have analyzed enough of your fixes, the Review suggestions from Gemini dialog is displayed.
Figure 2. Gemini fix issues dialog. (click to enlarge) To view AI-generated suggestions that are based on the changes you made, click Review suggestions.
Review Gemini conversion suggestions
The Fix issues with Gemini page displays suggestions generated by Gemini models based on the code changes that you have made. These suggestions contain similar changes that you can apply to other objects. For every suggestion, you can review, change, accept, or ignore the suggestion.
The Fix issues with Gemini page displays three variants of an object's source code, which you can select in the Edit view menu:
- Original source code (read-only)
- Draft destination source code (read-only)
- Destination source code generated with Gemini assistance (editable)
The Objects pane contains a list of objects that have issues and fixes suggested by Gemini models.
To review Gemini suggestions, follow these steps:
- Click an object to display the related AI-suggested fix.
- Review and edit the code that Gemini models suggested.
Do one of the following:
To accept the suggestion (including your edits), click Accept code. The changes are applied to the object in the conversion workspace, and the object state in the objects list changes from Pending to Accepted.
To keep the suggestion (including your edits) without applying the changes, switch to a different object. The object remains in the Pending state. You can edit the code and accept or ignore the suggestion later.
To ignore pending or accepted suggestions (and revert your edits), click Ignore code. The object state in the objects list changes from Pending to Ignored. Your changes are reverted. You can edit the code and apply it later.
To close Gemini suggestions and discard all changes that you haven't applied, follow these steps:
- On the Fix issues with Gemini page, click the back arrow.
In the Close Gemini dialog, click Close.
The current Gemini session is closed. To go back to the suggestions page, access Gemini suggestions again.
What's next
See how to work with conversion workspaces.
Learn how Gemini uses your data.
Follow the sample workflow for fixing conversion issues with Gemini assistance.