Convert SQL Server code and schema to PostgreSQL syntax

After youcreate your conversion workspace and perform the initial schema conversion,you can fix conversion issues, modify your objects with theinteractive editor, and apply converted schema to your destination database.

Databases can often have thousands of objects. Converting them all in a singlesession might be a challenging process. With conversion workspaces, you can dividethe conversion process into multiple phases where you add new objects to theconversion, fix the issues, and then test them in your destination database.

Conversion workspaces can produce deterministic conversion results, or enhancethem withGemini auto-conversion.When Gemini auto-conversion is enabled, Database Migration Serviceapplies auto-conversion augmentations to all your objects every time you convertthe source schema. If you want to use only deterministic conversion rules,disable Gemini auto-conversion in your workspace.

Note: Database Migration Service migrates only tables that have primary keys.If your source database includes tables that don't have primary keys,Database Migration Service conversion workspaces automatically create any missingprimary keys in the destination tables when youconvert your source code and schema. For more information on data migrationfor tables without primary keys, seeSource tables without primary keys.

To convert objects from your source database, do the following:

  1. In the Google Cloud console, go toConversion workspaces.

    Go to Conversion workspaces

  2. From the list of available conversion workspaces, select your workspace.

    Conversion workspace editor opens.

  3. Use theSQL Server schema panel to check your source objects for conversion issues. This panel contains all the objects you pulled from your schema during workspace creation.

  4. Fix your conversion issues.

    You can use the interactive SQL editor, upload a conversion mapping file to convert the object in a specific way, or utilize Gemini-powered conversion features.

  5. Optional: You can also use the interactive SQL editor to adjust the converted schema to better meet your needs, even if there are no conversion issues with your object. For a list of editable SQL Server objects, see Supported object types.
  6. After you fix conversion issues or adjust your schema, clickConvert source. Database Migration Service now analyzes your changes and generates the updated PostgreSQL schema.

    You can inspect the converted schema in theCloud SQL for PostgreSQL draft tab.

  7. Test the converted schema in your destination database. Do the following:
    1. ClickApply to destination>Test.
    2. On theDefine destination page, use theDestination connection profile
    3. drop-down menu to select your destination connection profile.
    4. ClickDefine and continue.
    5. On theSelect objects and test application page, use the checkboxes to select which
    6. converted PostgreSQL schema you want to apply in your destination database.
    7. ClickTest application.

    Depending on the test results, you might need to further adjust your converted schema.

  8. If the schema snapshot you pulled from the source has more objects that you haven't migrated yet, add these objects to the workspace:
    1. In theSQL Server panel, clickAdd objects.

      The object selection panel opens.

    2. In the schema tree, use the checkboxes to select which objects you want to add to the conversion and then clickAdd objects.
  9. Repeat steps 3 through 8 until you convert all the objects that you want to migrate.
  10. When you finish converting your schema, clickApply to destination>Apply.

    Database Migration Service now creates the schema definitions in your destination database.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.