Skip to main content

Database Version Management

This document introduces the database version management features of NineData, including their purposes and operation methods. It helps users achieve visual tracking of database structure changes, automatic version archiving, and is suitable for continuous delivery and operation and maintenance scenarios of databases.

Feature Overview

NineData Database Version Management is a non-intrusive database structure change (DDL) management solution. It achieves version control, historical tracing, difference comparison, and rollback operations of database structures through automated metadata collection, generation of global version numbers, and recording of table structure snapshots. The core features include:

  • Non-Intrusive: No need to create version tables in the target database.
  • Automated Collection: Capture metadata through scheduled tasks or event triggers (e.g., after SQL task execution) and automate the capture of full metadata once a week.
  • Support for Multiple Scenarios: SQL Console, SQL tasks, structure design and publishing, and other change sources. For changes executed through channels other than NineData, version information can also be generated through metadata collection (automatic and manual).
  • Visual Comparison: Provides version difference comparison and SQL auto-generation capabilities.

Collection Source Description

The NineData database version management feature mainly collects DDL changes through the following collection methods.

Collection Source
Description
Metadata CollectionCollected from MySQL's system database (information_schema), suitable for all types of changes. Triggered by system scheduled tasks (once a week) or manually by users. There is a certain difference between system collection and manual collection:
  • System Collection: Full structure collection of all databases and tables in the current database instance.
  • Manual Collection: Incremental structure collection of the user-specified database, i.e., the structure information of table objects that have changed since the last version.
SQL ConsoleAfter users execute DDL-related statements (such as table creation, column addition, index modification, etc.) in the NineData SQL Console, the system automatically recognizes and triggers collection.
SQL TaskFor SQL tasks submitted within the NineData platform, if the task contains DDL statements, the system automatically collects the changed structure after the task is completed.
Structure Design and PublishingAfter the structure change release process submitted through the platform's structure design and publishing module, the system triggers collection upon task completion.

Prerequisites

  • You have created or joined an organization, and this organization has subscribed to either or . Please ensure that your annual or monthly subscription is still active. For more information, please refer to Manage Organizations.
  • Your current account has switched to the target organization. For more information, please refer to Switching to an Organization.
  • Database type is MySQL.
  • The number of databases is less than or equal to 10, and the total number of tables is less than or equal to 2000.

Usage Limitations

  • Database DevOps Professional Edition users can collect up to 20 database versions.
  • Database DevOps Enterprise Edition users can collect up to 200 database versions.

Enable Database Version Management

NineData only collects metadata and version records for data sources that have enabled version management.

  1. Log in to the NineData Console.
  2. In the left navigation bar, click > .
  3. Under the tab, turn on the switch under the column on the right side of the target data source to enable database version management.

View Collected DDL Changes

For DDLs that NineData has already collected, you can view the details of the SQL at any time. If there are multiple versions, you can compare the SQL differences between two versions.

  1. Log in to the NineData Console.
  2. In the left navigation bar, click > .
  3. Under the tab, click under the column on the right side of the target data source.
  4. On the page, click under the column on the right side of the target database.
  5. Click under the column on the right side of the target version number to view the specific SQL statements. The following operations are also supported:
    • Select to compare the SQL statements with the previous version (if any).
    • Select to display the DDL changes involved in the current version (if any). By default, it displays a full mirror snapshot of the current database.
    • Click copy to copy the SQL statement to the clipboard, which can be pasted and executed elsewhere.
    • Click download to generate a download task and download it from . For details on how to download SQL files, see Download SQL Files.

Generate Change SQL

The Generate Change SQL feature is used to compare the differences between two database structure versions and automatically generate the DDL statements required to migrate from the old version to the new version. This feature supports precise comparison at the table structure level and outputs executable change scripts, helping users quickly complete structure upgrade operations, avoiding manual writing and omissions.

  1. Log in to the NineData Console.
  2. In the left navigation bar, click > .
  3. Under the tab, click under the column on the right side of the target data source.
  4. On the page, click under the column on the right side of the target database.
  5. Select the checkboxes on the left side of the two target versions and click in the upper right corner of the page. You can quickly find database versions through , Collection Source, Table Name, Version Number, Tag, etc.
  6. On the page, click at the top of the page. If there are differences between the two versions, SQL statements will be automatically generated. You can perform the following operations:, or click download icon to generate a download task and download it from . For details on how to download SQL files, see Download SQL Files.
    • Click under the window to initiate a change for the target data source.
    • Click copy to copy the SQL statement to the clipboard, which can be pasted and executed elsewhere.
    • Click download to generate a download task and download it from . For details on how to download SQL files, see Download SQL Files.

Generate Rollback SQL

The Generate Rollback SQL feature is used to restore the database structure from the current version to a specified historical version. The system automatically generates reverse DDL scripts by comparing the differences between the two versions, facilitating quick restoration of the database structure in case of failed releases or issues, ensuring system stability and recoverability.

  1. Log in to the NineData Console.
  2. In the left navigation bar, click > .
  3. Under the tab, click under the column on the right side of the target data source.
  4. On the page, click under the column on the right side of the target database.
  5. Select the checkboxes on the left side of the two target versions and click in the upper right corner of the page. You can quickly find database versions through , Collection Source, Table Name, Version Number, Tag, etc.
  6. On the page, click at the top of the page. If there are differences between the two versions, rollback SQL statements will be automatically generated.
    • Click under the window to initiate a rollback for the target data source.
    • Click copy to copy the SQL statement to the clipboard, which can be pasted and executed elsewhere.
    • Click download to generate a download task and download it from . For details on how to download SQL files, see Download SQL Files.

Add Tags to Database Versions

Database version numbers are automatically generated by the system, using timestamps or unique identifiers, which lack semantic information and are not easily recognizable by humans. Therefore, you can manually add tags to a version with special significance to improve version readability and management efficiency.

  1. Log in to the NineData Console.
  2. In the left navigation bar, click > .
  3. Under the tab, click under the column on the right side of the target data source.
  4. On the page, click under the column on the right side of the target database.
  5. Click the edit icon under the column on the right side of the target version, enter the tag name, and then click check.

Download SQL Files

The database version management feature provides a Download Center for centralized management and export of SQL files related to version management, including change SQL, rollback SQL, and full structure table creation statements. Users can download the scripts of the required version in one click for backup, audit, or offline execution, improving version delivery and collaboration efficiency.

Notes

  • After the download task is generated, it is retained for one month. If it expires, it cannot be downloaded anymore and requires re-generation of the download task.
  • After the download count reaches 10 times, the link will become invalid. If you need to continue downloading, you need to re-generate the download task.

Operation Steps

  1. Log in to the NineData Console.
  2. In the left navigation bar, click > .
  3. Click the tab and click under the column on the right side of the target download task.