Database structures often need to evolve as software applications grow. New business requirements may introduce additional tables, columns, relationships, constraints, and other database objects. However, updating an existing database is more complicated than simply recreating it because the database may already contain valuable production data that must be preserved.
Generate Database Patch Scripts in Visual Paradigm Desktop helps developers synchronize changes made to an Entity Relationship Diagram (ERD) with an existing database. By comparing the database design with the current database structure, Visual Paradigm can generate the SQL Data Definition Language (DDL) statements required to update the database or produce a patch script for manual review and execution.
This functionality supports an incremental database update workflow. Instead of dropping and recreating the entire database, developers can generate the necessary structural changes, such as creating new tables or altering existing ones, while retaining existing database objects and their data wherever the changes permit.
What Is Generate Database Patch Scripts?
Generate Database Patch Scripts is a database engineering feature in Visual Paradigm Desktop that analyzes differences between an ERD and an existing database to generate the SQL statements required to bring the database structure in line with the updated design.
The feature uses the Update Database generation mode. Visual Paradigm examines existing database objects and determines whether objects need to be created, altered, or left unchanged because they are already up to date.
Depending on the selected generation options, users can either:
- Generate a database patch script: Produce DDL files containing the required database changes without directly modifying the target database.
- Apply database changes directly: Connect to the target database and let Visual Paradigm execute the generated updates.
The generated patch scripts can be reviewed, modified, approved, and executed separately. This is particularly useful when database updates must follow a controlled deployment or production release process.
Why Is Database Patching Essential?
Database patching is essential when an application needs to evolve without losing the information already stored in its database. It provides a controlled way to introduce structural changes to an existing database instead of rebuilding it from scratch.
Preserve Existing Database Data
Production databases often contain business-critical information accumulated over months or years. Recreating the database can result in data loss or require complicated data migration procedures. Database patching focuses on applying structural changes to existing objects, helping preserve existing records when the requested changes allow it.
Synchronize Database Design and Implementation
Developers frequently update ERDs during application development. Without a synchronization mechanism, the actual database structure can gradually diverge from the documented design. Comparing the ERD with the existing database helps identify and apply the required structural changes.
Support Incremental Database Evolution
Applications rarely have a completely static database structure. New features may require new tables, additional columns, modified data types, or new relationships. Update Database generation supports these incremental changes without requiring the entire database to be recreated.
Separate Development and Production Database Changes
Developers may have direct access to development databases but restricted access to production environments. Generating DDL scripts allows database administrators or deployment personnel to review and execute the changes in the appropriate environment.
Reduce Manual SQL Authoring
Manually identifying differences between a database design and an existing database can be time-consuming and error-prone. Visual Paradigm analyzes the database objects and generates the corresponding update statements, reducing the amount of SQL that developers need to write manually.
Improve Database Change Management
Generating a separate DDL file creates an artifact that can be reviewed, stored, shared, and incorporated into an organization’s database deployment workflow. It also provides an opportunity to inspect potentially destructive operations before they are executed.
Edition and Availability
Generate Database Patch Scripts is part of Visual Paradigm Desktop’s database engineering capabilities. The database patching functionality is available in the following editions:
| Visual Paradigm Edition | Availability |
|---|---|
| Enterprise | Available |
| Professional | Available |
| Standard | Available |
| Modeler | Not available |
| Community | Not available |
Note: The availability refers specifically to database patch generation and database engineering capabilities. Having access to ERD modeling in an edition does not necessarily mean that database generation and patching are also available.
How Database Patch Generation Works
Visual Paradigm uses the ERD as the intended database design and compares it with the structure of the selected existing database. The Update Database generation mode determines which database objects are missing or outdated and generates the corresponding SQL operations.
Design-to-Database Comparison
The ERD describes the intended database structure, including entities, columns, data types, and relationships. The existing database represents the structure currently implemented in the selected DBMS.
When Update Database is selected, Visual Paradigm queries the existing database objects and compares them with the ERD. It then determines which objects need to be created or altered.
Generate Only the Necessary Updates
The update process is incremental rather than a complete database recreation. Its documented behavior includes:
- Missing database objects: Generate CREATE statements for objects that do not exist in the database.
- Outdated database objects: Generate ALTER statements when existing objects differ from the ERD.
- Up-to-date database objects: Generate no update for objects that already match the design.
Choose Between Script Generation and Direct Execution
After the differences have been analyzed, users can decide how to apply the changes.
- Script-based patching: Disable Export to database and enable Generate DDL. Visual Paradigm produces the DDL file without directly applying the changes to the database.
- Direct database patching: Enable Export to database. Visual Paradigm connects to the configured database and applies the generated updates.
This distinction allows the same database update workflow to support both automated development environments and controlled production deployments.
Functionality Breakdown
The database patching workflow uses several settings in the Database Generation window. The following sections explain the major capabilities and configuration options.
Update Database Generation Mode
Update Database is the generation mode used to patch an existing database.
Unlike Create Database, which generates database creation statements, Update Database examines the existing database and generates the required CREATE and ALTER statements according to the differences it finds.
Its documented behavior can be summarized as follows:
| Database condition | Update behavior |
|---|---|
| Object does not exist in the database | Generate a CREATE statement. |
| Object exists but is outdated | Generate an ALTER statement as required. |
| Object is already up to date | No update is required. |
Export to Database
The Export to database option controls whether Visual Paradigm directly applies the generated database changes to the configured target database.
- Enabled: Visual Paradigm connects to the database and applies the required updates.
- Disabled: Visual Paradigm does not directly patch the database. Users can generate a DDL file instead by enabling Generate DDL.
This option is particularly important when production database changes must be reviewed or executed by a database administrator.
Generate DDL
Generate DDL controls whether Visual Paradigm generates SQL Data Definition Language scripts as output.
DDL contains SQL statements used to define or modify database structures. Examples include CREATE TABLE, ALTER TABLE, and DROP TABLE statements.
When users want to generate a patch script for manual execution, the typical configuration is:
- Generate Database: Update Database
- Export to database: Disabled
- Generate DDL: Enabled
The generated DDL file is saved to the folder specified in Output Path.
Include Drop Table/Columns That Not Exist in ER Model
This option controls whether database tables and columns that are absent from the ER model should be dropped during the patching process.
When enabled, Visual Paradigm can generate database changes that remove tables or columns that are no longer represented in the ERD.
Important data-loss warning: Dropping a table or column disregards the data stored in that object. Any records or column values contained in the dropped objects will be lost. Review the proposed changes carefully before enabling this option, especially when working with production databases.
When the objective is to preserve existing database data, avoid enabling this option unless the removal of those database objects is intentional and the consequences have been evaluated.
Output Path
Output Path specifies the folder where generated DDL files and other generated output files are stored.
When generating database patch scripts without directly updating the database, the specified folder is where users can retrieve the resulting DDL file.
Choose an appropriate output folder so that the generated scripts can be reviewed, tested, archived, or distributed to the database deployment team.
Schema
The Schema setting specifies the database schema targeted by database generation.
When working with databases that contain multiple schemas, select the appropriate schema to ensure that the generated database changes are associated with the intended database objects.
Generate Comment
Generate Comment controls whether entity and column descriptions from the ER model are generated as comments for database tables and columns.
This option helps transfer documentation maintained in the ERD into the generated database definitions.
According to the documented option availability, Generate Comment is supported for MySQL, DB2, Oracle, and PostgreSQL.
Upper Case SQL
Upper Case SQL forces the generated DDL content to use uppercase SQL keywords and statements.
This is a formatting preference that can help maintain consistency with an organization’s SQL conventions. It does not change the intended database structure.
Formatted SQL
Formatted SQL applies line breaks and indentation to the generated SQL statements, making the DDL easier to read and review.
This is useful when database patch scripts need to be inspected or maintained manually.
Custom DDL
Custom DDL allows users to customize the generated DDL output by adding custom comments and SQL statements before or after the automatically generated statements.
It supports several customization scenarios:
- Add custom comments to the generated script.
- Include the date and time when the DDL was generated.
- Include the author name in the script comments.
- Add descriptions explaining assumptions or database configuration requirements.
- Execute custom SQL before the generated DDL.
- Execute custom SQL after the generated DDL.
For example, custom DDL can be used to include environment initialization or cleanup statements around the generated database changes.
Generate Individual DDL
Generate Individual DDL separates table creation statements and foreign key constraint creation statements into two files.
This provides more flexibility when database creation needs to be organized into separate stages, such as creating tables first and applying foreign key constraints afterward.
Separate Create/Drop DDL
Separate Create/Drop DDL splits table creation statements and table drop statements into separate files.
This helps organize generated SQL according to the type of database operation being performed.
Generate Sample Data
Generate Sample Data supports generating sample table records defined for entities in the ER model.
This capability helps development and testing teams use a common set of sample records when working with database designs.
It is a sample-data generation option rather than a substitute for a production data migration strategy.
Quote SQL Identifier
Quote SQL Identifier controls whether SQL identifiers are enclosed in appropriate quotation characters.
This is useful when identifiers contain reserved SQL words, such as SELECT or ORDER.
The documented settings include:
- Auto: Automatically determine when identifier quoting is appropriate.
- Yes: Add quotation marks to SQL identifiers.
Using reserved SQL keywords as table or column names is generally discouraged because it can introduce compatibility and SQL syntax problems.
Column Order
Column Order controls the order in which columns are generated in CREATE TABLE statements.
By default, Visual Paradigm follows the column order defined in the ER model. Alternatively, users can arrange key and index columns before other columns.
Generating key and index columns first may help avoid certain problems during data insertion, depending on the database and application workflow.
Table Charset
Table Charset specifies the character set used for generated database tables.
Examples of character sets include UTF8, BIG5, GB2312, and LATIN1.
This option is documented as available for MySQL users.
DDL Extension
DDL Extension determines the file extension used for generated DDL files.
The documented choices are:
- .ddl
- .sql
This allows teams to use a file extension that matches their preferred SQL script conventions.
Connection Provider Class
Connection Provider Class specifies the strategy used to obtain JDBC connections.
It determines how the application obtains a database connection when database connectivity is required. Users who are unfamiliar with this setting can generally leave it at its default value.
Connection
The Connection setting provides database connectivity configuration options for Hibernate ORM-related generation.
The documented connection modes include:
- JDBC: Uses the standard Java Database Connectivity API.
- Datasource: Uses a database connection provided by an application server.
- JDBC + Datasource: Generates two configuration files for JDBC and datasource connectivity.
JDBC Connection Pool Options
Connection pooling allows multiple database operations to reuse established connections instead of repeatedly opening and closing connections.
The documented Use connection pool option allows users to disable connection pooling when necessary.
Production and Personal Database Configuration
Visual Paradigm supports different database connection settings for different working environments.
- Production: Uses the database connectivity settings stored in the project and shared among team members.
- Personal: Allows an individual user to specify their own connection URL and database settings for their environment. These personal settings are not committed to the server.
This separation is useful when multiple developers share the same ERD but connect to different development databases, while production uses a separate database connection.
Database Options
Database Options provides access to database configuration settings, including the selected DBMS and its connection details.
A default DBMS must be selected for database generation to function. If multiple DBMS configurations are available, the default DBMS determines which database platform is used for database and DDL generation.
Test Connection
Test Connection verifies whether the configured database connection settings are valid and whether Visual Paradigm can connect to the target database.
A successful connection test confirms that the configured connection can be established. It does not itself apply database patches.
How to Generate Database Patch Scripts
Follow these steps to compare an updated ERD with an existing database and generate a database patch script.
Prepare the ERD
Open the database design project in Visual Paradigm Desktop and update the ERD to reflect the intended database structure.
For example, you might:
- Rename an existing entity.
- Add a new column to an existing entity.
- Introduce a new entity representing a new database table.
- Add a relationship between existing entities.
- Modify existing database definitions.
Ensure that the ERD represents the intended database structure before generating the patch.
Open Database Generation
From the main menu, select Tools > DB > Generate Database… to open the Database Generation window.
The menu wording may appear as Tools > Database > Generate Database… in some documented versions of the application.
Select Update Database
In the Database Generation window, locate the Generate Database setting and select Update Database.
This tells Visual Paradigm to compare the ERD with the existing database and generate the required updates rather than creating an entirely new database.
Configure Script Generation
To generate a patch script without directly modifying the database:
- Specify the destination folder in Output Path.
- Select Update Database as the generation mode.
- Uncheck Export to database.
- Check Generate DDL.
- Review the remaining database generation options.
This configuration instructs Visual Paradigm to generate the SQL update script without directly applying the changes to the database.
Configure Database Options
Review the relevant settings, including the target schema, SQL formatting, identifier quoting, and other generation options.
If you intend to remove tables or columns that no longer appear in the ERD, review the Include drop table/columns that not exist in ER model option carefully. Enabling it may cause existing database data to be discarded.
Generate the Patch Script
Click OK to start the generation process.
After successful generation, navigate to the folder specified in Output Path to retrieve the generated DDL file.
Review and Execute the Script
Open the generated DDL file and review the SQL statements before executing them against the intended database.
Pay particular attention to:
- CREATE statements for newly introduced objects.
- ALTER statements for modified database objects.
- DROP statements, if removal of tables or columns was enabled.
- Target schema and database compatibility.
- Any custom DDL statements included before or after the generated SQL.
Test the patch against a representative non-production database before applying it to production. Database administrators can then execute the approved script using their preferred database management tools.
How to Apply Database Changes Directly
Visual Paradigm can also apply the generated database changes directly to an existing database without requiring users to generate and manually execute a DDL file.
To use this workflow:
- Open the project containing the updated ERD.
- Select Tools > DB > Generate Database….
- Select Update Database.
- Ensure the correct default DBMS and database connection are configured.
- Enable Export to database.
- Review the other database generation options.
- Click OK to start the update process.
If the operation succeeds, the target database will be patched according to the updated ERD.
Important: Direct database patching executes changes against the configured database. Verify the target connection, database permissions, and potentially destructive operations before proceeding.
Database Configuration Requirements
Database configuration is required because Visual Paradigm must be able to connect to the target database when performing database generation and direct database patching.
Configure the DBMS
To configure database connectivity:
- Select Tools > DB > Database Configuration… from the main menu.
- Set the programming language of the project where applicable.
- Select the DBMS vendors used by the project.
- If multiple DBMS configurations are selected, right-click the intended DBMS and select Set as default.
- Configure the database driver settings.
- Specify the database connection URL.
- Enter the database username and password.
- Click Test Connection to verify the configuration.
Understand the Database Driver Settings
- Version: Specifies the database version to use for the connection configuration.
- Driver: Identifies the JDBC driver supplier.
- Driver file: Specifies the JDBC driver file required for connectivity. Visual Paradigm provides an option to download the driver automatically.
- Connection URL: Specifies the information required by the JDBC driver to connect to the database.
- User: Specifies the database username.
- Password: Specifies the corresponding database password.
- Engine: For MySQL and MariaDB, specifies the table engine, such as InnoDB or MyISAM.
When multiple database platforms are configured, database and DDL generation follow the selected default DBMS. Make sure the default database platform matches the intended target environment.
Supported Database Platforms
Visual Paradigm provides database generation and reverse-engineering support for a wide range of database management systems.
Its documented platform coverage includes:
- MySQL
- Microsoft SQL Server
- Oracle
- Sybase
- PostgreSQL
- HSQL
- MariaDB
- Derby
- Informix
- Firebird
- SQLite
- IBM DB2
- FrontBase
- H2
- Amazon Redshift
- Exasol
- Teradata
- AWS Athena
Actual database generation options and SQL behavior depend on the selected DBMS, its version, and the supported database features. Consult the database configuration and generation settings for the target platform.
Practical Database Patching Workflows
Adding a New Column to an Existing Table
Suppose an application needs to store a discount value for each computer part. The existing ERD contains a Computer_Part entity, but the database does not yet have a discount column.
The workflow is:
- Open the ERD and add a new column named discount to Computer_Part.
- Specify its intended data type, such as numeric(8, 2).
- Open the Database Generation window.
- Select Update Database.
- Generate the DDL script without enabling Export to database.
- Review the generated SQL and execute the approved patch.
Visual Paradigm analyzes the difference and generates the database update required to introduce the new column.
Adding a New Table and Relationship
Suppose a system needs a new Part_Usage table to record how computer parts are used.
The developer can introduce the new entity and its relationships in the ERD, then use Update Database to generate the required database changes.
The generated updates can include the creation of the new table and the corresponding relationship-related database structures, as required by the model and target DBMS.
Renaming an Entity
Suppose an existing entity named Addresses is renamed to Customer_Addresses in the ERD.
After the design change, use Update Database to compare the revised model with the existing database. Review the resulting DDL carefully to determine how the target database changes will be represented and whether any data migration or object-renaming considerations apply.
A model rename should not automatically be assumed to be a data-preserving database rename. Review the actual generated statements before execution.
Generating a Production Database Patch
When a development team needs to deploy a database change to production, a script-based workflow is often preferable.
- Update and validate the ERD in the development project.
- Connect to the appropriate development database or configure the intended default DBMS.
- Select Update Database.
- Disable Export to database.
- Enable Generate DDL.
- Generate the patch script.
- Review and test the SQL in a non-production environment.
- Submit the approved script to the production database administrator or deployment process.
- Execute the patch against the intended production database.
This approach separates database design, SQL generation, review, and deployment responsibilities.
Best Practices and Important Considerations
Keep the ERD Accurate
The quality of the generated patch depends on the accuracy of the ERD. Ensure that entity definitions, column types, relationships, and other relevant database properties reflect the intended design before generating updates.
Use Update Database for Incremental Changes
When modifying an existing database, select Update Database rather than Create Database or Drop and Create Database. The update mode is designed to analyze existing database objects and generate the necessary incremental changes.
Review Destructive Operations
Be especially careful when enabling the option to drop tables or columns that are absent from the ERD. Removing database objects can permanently discard their stored data.
Prefer Script Generation for Controlled Deployments
When changes must pass through a review or approval process, generate a DDL file instead of applying the changes directly. This gives database administrators an opportunity to inspect and approve the SQL before execution.
Verify the Target Database
Always confirm the default DBMS, connection URL, schema, and database credentials. Accidentally connecting to the wrong environment can result in changes being applied to an unintended database.
Test Before Production Deployment
Execute the generated patch against a test or staging database before applying it to production. This helps identify compatibility problems, unexpected SQL operations, and potential data migration requirements.
Back Up Important Data
Although database patching is designed to apply incremental structural changes, not every possible schema change is inherently risk-free. Back up important databases before executing patches, especially when modifying or removing existing columns and tables.
Do Not Assume Every Model Rename Is a Safe Database Rename
Renaming an ERD entity or column does not necessarily mean that the generated SQL will perform a simple database rename operation. Depending on the DBMS and the differences detected, the resulting statements may require additional data migration or manual adjustment.
Use the Correct Database Version and Driver
Database versions can differ in supported SQL syntax and capabilities. Select the correct DBMS version and JDBC driver to ensure that Visual Paradigm uses the appropriate connection configuration.
Limitations and Troubleshooting
Why Is the Database Generation Option Unavailable?
Database patching is an edition-dependent feature. Confirm that the installed Visual Paradigm Desktop edition supports database engineering and database generation.
Why Can I Not Patch the Database?
Visual Paradigm requires a configured default DBMS to perform database generation. Open Database Configuration, select the intended DBMS as the default, and verify the connection settings.
Why Does the Connection Test Fail?
Check the database connection URL, username, password, database driver, driver file, and database availability. Also verify that the selected database version matches the target database.
Why Is No Update Generated?
When Update Database finds that the existing database objects already match the ERD, no update is required for those objects. Confirm that the intended design changes have been saved and that the correct database and schema are selected.
Where Is the Generated Patch Script?
When Generate DDL is enabled, the generated DDL file is saved in the folder specified by Output Path. Check that folder after successful generation.
Why Are Tables or Columns Being Dropped?
Check whether Include drop table/columns that not exist in ER model is enabled. This option allows Visual Paradigm to remove database objects that are absent from the ERD. Disable it if those objects should remain in the database.
Why Does the Generated SQL Look Different from My Preferred Format?
Review the Upper Case SQL, Formatted SQL, Quote SQL Identifier, and DDL Extension settings. These options control the presentation and formatting of the generated SQL output.
Can I Generate a Script Without Modifying the Database?
Yes. Disable Export to database and enable Generate DDL. This generates the database update script without directly applying the changes to the target database.
Can I Apply the Changes Automatically?
Yes. Enable Export to database and ensure that the default DBMS and database connection are configured correctly. Visual Paradigm will apply the generated changes directly to the database.
Frequently Asked Questions
What does Generate Database Patch Scripts do in Visual Paradigm?
It compares an ERD with an existing database and generates SQL statements to update the database structure according to the model. It supports incremental changes instead of requiring the entire database to be recreated.
Does database patch generation preserve existing data?
The feature is designed to apply structural changes while preserving existing data wherever possible. However, operations such as dropping tables or columns can destroy the data stored in those objects. Always review the generated SQL and back up important databases before execution.
What is the difference between Create Database and Update Database?
Create Database generates database creation statements. Update Database examines an existing database and generates CREATE or ALTER statements for missing or outdated objects, while leaving up-to-date objects unchanged.
How do I generate a database patch script without connecting to the database for execution?
Configure the database connection required for schema comparison, select Update Database, disable Export to database, enable Generate DDL, specify Output Path, and click OK. The resulting SQL script can be reviewed and executed separately.
Does Generate DDL automatically update my database?
No. Generate DDL produces a SQL script. To have Visual Paradigm apply changes directly to the configured database, enable Export to database.
What is the difference between Export to database and Generate DDL?
Export to database controls whether Visual Paradigm applies changes directly to the database. Generate DDL controls whether SQL scripts are produced as files. They serve different purposes and can be configured according to the desired workflow.
Can I review the SQL before applying database changes?
Yes. Disable Export to database and enable Generate DDL to generate the patch as a separate file. Review and modify the SQL before executing it with an external database tool.
Can Visual Paradigm automatically detect new tables and columns?
Yes. Update Database compares the ERD with the existing database and generates the required statements for database objects that are missing or outdated.
Does Update Database recreate the entire database?
No. Update Database is an incremental update mode. It generates the required CREATE and ALTER statements based on differences between the ERD and the existing database.
Can I delete database columns that are no longer in the ERD?
Yes. Enable Include drop table/columns that not exist in ER model. However, dropping a column or table discards the data stored in it. Review the consequences before enabling this option.
Where does Visual Paradigm save generated database patch scripts?
Generated DDL files are saved in the folder specified by Output Path in the Database Generation window.
Can I use the generated patch script on a production database?
Yes. You can generate the DDL script without directly modifying the database, review and test it, and then execute it against a production database using an appropriate database management tool.
Does database patch generation require a default DBMS?
Yes. A default DBMS must be selected in Database Configuration for database generation to function.
Can I use different database connections for development and production?
Yes. Visual Paradigm supports Production and Personal database connection settings. Personal settings allow individual users to maintain their own connection information without committing those settings to the shared server.
What happens if the database is already synchronized with the ERD?
If the database objects are already up to date, Update Database does not generate updates for those objects.
Does the feature support multiple database platforms?
Visual Paradigm supports database generation and reverse engineering for various DBMS platforms, including MySQL, Microsoft SQL Server, Oracle, PostgreSQL, MariaDB, SQLite, IBM DB2, and others. The actual options and SQL behavior depend on the selected database platform.
Which Visual Paradigm editions support database patch generation?
Generate Database Patch Scripts is available in Enterprise, Professional, and Standard editions. It is not listed as available in Modeler or Community editions.
Can I customize the generated SQL?
Yes. Custom DDL allows users to add comments and SQL statements before or after the generated DDL. Other settings, such as SQL formatting, uppercase SQL, identifier quoting, and file extension, provide additional output customization.
Is Generate Sample Data the same as database patch generation?
No. Generate Sample Data is an additional database generation option for producing sample records defined in the ER model. It is not the mechanism used to compare and synchronize database structures.
Can I use Generate Database Patch Scripts to migrate existing data between different database platforms?
The feature is designed to synchronize database structures with an ERD. It should not be treated as a complete cross-platform data migration tool. Data transformation and migration between different DBMS platforms may require additional procedures and tools.
Summary
Generate Database Patch Scripts in Visual Paradigm Desktop provides a practical way to synchronize an existing database with an updated Entity Relationship Diagram. By using Update Database, developers can identify missing or outdated database objects and generate the SQL statements required to apply incremental structural changes.
The feature supports two main workflows: generating DDL files for manual review and execution, or applying changes directly to a configured database. Additional options provide control over schema selection, SQL formatting, custom DDL, identifier quoting, object removal, and database connectivity.
For development teams maintaining evolving applications, database patch generation helps keep database implementations aligned with their designs while reducing unnecessary database recreation and supporting more controlled database updates.
VISUAL PARADIGM