Data version difference comparison system and method based on data management model
Through the difference comparison system based on the data management model, differentiated scripts are generated, which solves the upgrade problems caused by dependencies between multiple applications and realizes the automation and efficient deployment of large version upgrades.
Patent Information
- Application Number
- CN202310334278.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2024-10-01
AI Technical Summary
In a major version upgrade scenario, there are dependencies between multiple applications, resulting in coupling of upgrade scripts, making it impossible to successfully complete the major version upgrade. Existing technology cannot effectively solve the upgrade dependency problem caused by table structure changes between applications.
Provide a data version difference comparison system based on the data management model, including a data model management module, a data script generation module and a data publishing module. Through table structure management, initial data management and dependency management, differentiated scripts are generated to ensure the table structure Change the unified prefix to avoid execution order errors.
It simplifies the preparation of upgrade scripts, reduces dependency coupling between applications, improves upgrade efficiency and quality, realizes automated deployment in multi-environment and multi-version scenarios, and improves work efficiency.
Smart Images

Figure CN118733071A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data management, and in particular to a data version difference comparison system and method based on a data management model. Background Art
[0002] China Baowu Industrial Internet Platform consists of hundreds of functional modules. With the continuous application and promotion of the platform, hundreds of sets have been deployed in multiple industries such as steel, medicine, and rail. In order to enhance the user experience and meet the functional requirements of platform construction, the platform needs to upgrade the platform functions of each online environment under complex conditions with multiple functional module combinations and diverse environments. At present, for the upgrade of each major version of the platform, the R&D personnel will stack the upgrade scripts of each minor version between the major versions to form an upgrade script and the downgrade scripts to form a downgrade script according to the difference between the current version of each application and the previous major version, which is used to complete the data release. During the implementation process, it was found that the above-mentioned method of completing the upgrade by executing the upgrade and downgrade scripts according to the application is only applicable to the upgrade scenario of a single application with no external dependencies. In the scenario of major version upgrade, it involves the upgrade and release of a large number of applications, and there are dependencies between the applications. The script coupling will eventually lead to the failure to successfully complete the major version upgrade.
[0003] like Figure 1 The major version upgrade script is composed of the upgrade scripts required for each application upgrade and release in the platform. Take application A and application B as examples. The major version of the platform is upgraded from V2 to V3. In the upgrade script of application B V2.7, the table structure of table B1 is changed by adding fields. In the upgrade script of application A V2.8, the table structure of table A1 is changed by adding fields. In the upgrade script of application B V3.0, data needs to be added to table A1. Application B V3.0 depends on table A1 of application A V2.8. To ensure normal upgrade, the script of application A V2.8 needs to be executed before the script of application B V3.0. Otherwise, the table structure of table A1 has not changed, and the script for executing the new data will report an error due to the mismatch of the number of fields. However, the script of application A V3.0 contains the initialization data script for adding data to table B1, so it needs to be executed after the script of application B V2.7. At this time, no matter which application A or B executes the upgrade first, the upgrade script will fail because the table structure of the dependent table has not been upgraded. At this time, it is necessary to manually identify dependencies and combine scripts, otherwise the major version upgrade will be difficult to implement successfully.
[0004] Patent document CN104216948A (application number: CN201410393303.4) discloses a data model difference control method, comprising the following steps: a) obtaining PDM model files of different versions of databases; b) extracting the data structure of each basic element in the PDM model file and saving it in the database; c) reading the data structures of all basic elements in two PDM model files from the database and performing difference comparison one by one; d) using visual graphics and statistical data to display the difference results of two versions of databases corresponding to the two PDM model files.
[0005] Comparing with the current domestic comparison products, we found that these products have the following limitations: there is no version management, and they can only compare the differences between two schemas or two tables; they cannot obtain relevant data in the table based on the application or version, and can only compare the entire data; they cannot solve the upgrade dependency problem caused by changes in the table structure between applications. Summary of the invention
[0006] In view of the defects in the prior art, the object of the present invention is to provide a data version difference comparison system and method based on a data management model.
[0007] The data version difference comparison system based on the data management model provided by the present invention includes a data model management module, a data script generation module and a data publishing module;
[0008] The data model management module includes table structure management, initial data management, version management and dependency management;
[0009] The data script generation module performs difference comparison, script generation and comparison history management based on the data model management module, obtains the difference comparison result and transmits it to the data publishing module;
[0010] The data publishing module includes data publishing, data backup and data rollback.
[0011] Preferably, the table structure management includes: maintaining the tables required for the business application functions in a unified manner in the difference comparison system through an import function, classifying the data according to the application information and version information, providing a page in the difference comparison system for querying and maintaining relevant data, and adding, modifying, deleting and querying information including table names, fields, constraints and indexes;
[0012] The initial data management includes: maintaining the initial data information required for business application functions in a unified manner in the difference comparison system through an import function, classifying data according to application information, table information and version information, and providing pages in the difference comparison system to maintain relevant data, including the addition, modification, deletion and query of initialization data including configuration items, service information and resource information.
[0013] Preferably, the version management includes: maintaining the table structure and initial data of different versions of the application in a difference comparison system, viewing basic application version information through a page, combining through the version management function, and incorporating different applications into the same application group for batch release.
[0014] Preferably, the dependency management includes: when the application imports initial data, maintaining the dependency of the initial data not stored in its own business table, including application information, version information, dependency table information and dependency table version information; at the time of release, confirming the field information in the application version configuration table based on the maintained relationship, and combining it with the configuration data to generate an insert statement.
[0015] Preferably, the difference comparison includes: determining the publishing environment, publishing application, target version and current version according to the publishing task, then obtaining the data management model from the application information and version information, comparing different versions of the model, identifying table structure differences, giving priority to comparing table list differences, confirming whether it is a newly added table, and then comparing the table fields, indexes, and constraint information.
[0016] Preferably, the script generation includes: generating a differential script according to the comparison result, wherein the first part of the script file is a table structure differential script to avoid failure due to interdependence between applications during execution, resulting in failure of data change before the table structure is upgraded; the second part is an initial data script, including a statement to delete all initial data of the old version and a statement to add all initial data of the new version.
[0017] Preferably, the comparison history management includes: retaining the history according to the selected configuration for each comparison, opening the history page to view the comparison details and re-downloading the comparison results, and the selected configuration includes the release environment, the target version and the current version.
[0018] Preferably, the data publishing includes: executing the difference script through the difference comparison system and outputting the execution log;
[0019] The data backup includes: confirming the list of tables to be backed up and completing the backup according to the data management model;
[0020] The data rollback includes: when an exception occurs in the release, full rollback is performed through backup.
[0021] According to the data version difference comparison method based on the data management model provided by the present invention, the following steps are performed:
[0022] Step 1: Initialize the data management model, formulate input standards, prepare the original input and import it into the data management model;
[0023] Step 2: Determine the publishing environment, publishing application, target version, and current version based on the publishing task, and then obtain the corresponding data management model based on the application information and version information. Compare different versions of the data management model, identify the differences in table structures, and obtain the comparison results and table list.
[0024] Step 3: Generate a table structure script based on the comparison results. According to the specific script content, modify the tables, indexes, fields, and permissions in the database. Generate corresponding delete statements based on the full initial data of the current version of the online environment, and generate corresponding add statements based on the full initial data of the target version, and replace all the data of the online environment application.
[0025] Step 4: Back up related tables and data according to the table list. Roll back the entire table through the backup if an exception occurs. Track and handle script problems according to the exception log. Continue to publish data after confirming that everything is correct.
[0026] Preferably, the step 2 comprises:
[0027] Step 2.1: Determine the list of applications to be released according to the release task, configure it as an application combination, and confirm the corresponding table list;
[0028] Step 2.2: Compare different versions of the same-name table. After obtaining the table metadata information, compare the field type, length, default value, whether NULL is allowed, and field description of different versions of the table. Then compare the table index, table constraint, table primary key, and table description.
[0029] Step 2.3: If there is no table with the same name in the historical version, then it is the table to be added, and all table structure information is obtained without comparison;
[0030] Step 2.4: When some tables are no longer used in the new version of the business adjustment, they are the tables that need to be deleted. Migrate the data as required and keep them for a period of time before taking them offline.
[0031] Compared with the prior art, the present invention has the following beneficial effects:
[0032] (1) The present invention performs unified online version management on the data structure and initial data of the software version, which simplifies the script preparation process. There is no need to pay attention to the differences caused by different actual environments. It only needs to prepare according to the current version, isolating the complexity caused by environmental differences;
[0033] (2) The present invention reduces the coupling caused by the dependency between applications. When upgrading, there is no need to pay attention to the changes of other applications. The differential script will publish the table structure changes involving the application in a unified front-end and execute them first;
[0034] (3) The present invention solves the shortcomings of the traditional upgrade model in dealing with multi-environment and multi-version scenarios, effectively improves the efficiency and quality of deployment and upgrade, and uses data version management to unify the management of data in each module; it improves work efficiency, and deployment implementation personnel can independently obtain upgrade scripts. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0036] Figure 1 Describes the dependency relationship of the script for major version upgrades;
[0037] Figure 2 It is a data management model diagram;
[0038] Figure 3 It is the main functional module diagram;
[0039] Figure 4 One-click comparison of page images;
[0040] Figure 5 It is a comparison chart of table structure differences;
[0041] Figure 6 This is a comparison chart of initial data differences. DETAILED DESCRIPTION
[0042] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0043] Embodiment 1:
[0044] The present invention provides a data version difference comparison method based on a data management model, including data model maintenance, difference comparison, data publishing, etc. The data management model is maintained according to the application version, and each data management model covers the full amount of data of all applications under the major version of the platform, including table structure and initial data. Based on the maintained data management model, by comparing the final version of each application under the major version, the table structure and initialization data difference script are generated, and the difference scripts involving table structure changes are uniformly executed first, and then the initialization data difference scripts are uniformly executed. In this way, the dependency of table structure changes between applications and the problem of being unable to identify the order of script execution are avoided.
[0045] The data management model is a data collection based on version management, see Figure 2Among them, application information and version information are the basic information of the model, which can be used as identifiers to define the data range; table-related information mainly includes table lists, table structures, and dependencies between tables; initial data information mainly includes configuration items, service information, resource information and other related initialization data.
[0046] The essence of data version difference comparison is to obtain a specified version of the data management model, compare it with the corresponding version of the data management model in the online environment, generate a differential script, support the deployment and upgrade of a single application or multiple applications, and compare the final state. It is expressed as directly generating a whole script instead of splicing it with procedural upgrade and downgrade scripts. It can effectively solve problems such as inconsistent applications and versions in different environments, complex dependencies between applications, script coupling, and difficult maintenance.
[0047] A data version difference comparison method provided by the present invention includes the following steps:
[0048] Step 1: Data model management. To initialize the data management model, input standards are established. R&D personnel prepare the original input according to the standards and import it into the system. The main data include the following categories:
[0049] 1) Table list: This file maintains the English names of all business tables of the application (i.e. the English names of tables required to be created for business functions);
[0050] 2) Table creation script: This file provides table creation statements for all business tables, including table fields, constraints, indexes, descriptions, and other information. It is the final state structure corresponding to the current application package version, and no modification statements should be provided;
[0051] 3) Initial data: The first line in the file provides the English name of the corresponding table field, and each subsequent line corresponds to an initial data.
[0052] Step 2: Difference comparison: determine the publishing environment, publishing application, target version, and current version based on the publishing task, and then obtain the data management model based on the application information and version information. Compare different versions of the model. The core of the comparison is to identify table structure differences.
[0053] 1) Determine the list of applications to be released according to the release task, configure it as an application combination, and then confirm the corresponding table list;
[0054] 2) Compare different versions of the same-name table. After obtaining the table metadata information, compare the field type, length, default value, whether NULL is allowed, and field description of different versions of the table in turn. Then compare the table index, table constraint, table primary key, and table description.
[0055] 3) If there is no table with the same name in the historical version, it is a table that needs to be added, and no comparison is required to obtain all table structure information;
[0056] 4) When some tables are no longer used in the new version of business adjustment, they are the tables that need to be deleted. Because they contain business data, the data needs to be migrated as required. After being retained for a period of time, they are handled with caution and taken offline. The differences are not processed here.
[0057] Step 3: Script generation. The final differentiation script mainly includes two parts: table structure and initial data.
[0058] 1) Table structure scripts are generated based on the comparison results. The differentiated scripts of the table structures of each application are summarized and placed at the front of the entire script file to avoid failures caused by data changes before the table structure is upgraded due to mutual dependence between applications;
[0059] 2) The initial data generates a script according to the principle of full deletion and full addition. The full initial data of the current version of the online environment generates the corresponding deletion statements, and the full initial data of the target version generates the corresponding addition statements, and the online environment application's own data is fully replaced.
[0060] Step 4: Data release. Back up related tables and data according to the table list for rollback in case of exceptions that cannot be handled. Execute differential script upgrades. After confirmation, complete data release.
[0061] Embodiment 2:
[0062] The present invention provides a data version difference comparison system based on a data management model, which is composed of a data model management module, a data script generation module, and a data publishing module. Figure 3 ,The data management module provides data management functions such as table ,structure information, initial data information, dependency information and ,other data management functions through tools. The data script generation module provides ,difference comparison, script generation and other functions and supports single ,application or multiple applications. The data publishing module provides data backup, data ,publishing, data rollback and other functions.
[0063] China Baowu Industrial Internet Platform has deployed hundreds of environments, and the major versions of the platform are continuously updated and iterated. During this period, some environments may have released small versions or patch versions of a certain module. There are many environments and inconsistent versions. After the platform releases a new major version, it is difficult to quickly align all environments to the latest version. In order to handle such situations and reduce the difficulty of preparing upgrade scripts, a data version management system has been specially developed. The core function is to compare data version differences based on the data management model, and automatically generate differentiation scripts based on the comparison results.
[0064] The system operation process is:
[0065] 1. The developer prepares the original input according to the agreed standards. The table creation statements are exported in batches through the database connection tool. The initial data is exported at one time by selecting the corresponding table and checking the data on the development tool page.
[0066] 2. Click the Import button on the model management page to import the original input into the data version management system. You can view the import results on the current page and confirm the data model content.
[0067] 3. The deployment implementer enters the one-click comparison page, selects the target environment for the upgrade, the target delivery version, confirms the automatically obtained current version of the target environment, and clicks the "Start Comparison" button. Figure 4 ;
[0068] 4. After the comparison is completed, check the comparison analysis report, including the comparison range, table structure differences (such as Figure 5 ), initial data information (such as Figure 6 ) and so on, simply confirm the changes;
[0069] 5. Download the generated differential script;
[0070] 6. Back up the database;
[0071] 7. Execute the differentiated script to complete the data publishing process;
[0072] 8. After the application is released and the functions are verified, the release is successfully completed.
[0073] Those skilled in the art know that, in addition to implementing the system, device and its various modules provided by the present invention in a purely computer-readable program code, it is entirely possible to implement the same program in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, the system, device and its various modules provided by the present invention can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures within the hardware component; the modules for implementing various functions can also be considered as both software programs for implementing the method and structures within the hardware component.
[0074] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.
Claims
1. A data version difference comparison system based on a data management model, characterized in that: It includes data model management module, data script generation module and data publishing module; The data model management module includes table structure management, initial data management, version management and dependency management; The data script generation module performs difference comparison, script generation and comparison history management based on the data model management module, obtains the difference comparison result and transmits it to the data publishing module; The data publishing module includes data publishing, data backup and data rollback.
2. The data version difference comparison system based on the data management model according to claim 1 is characterized in that: The table structure management includes: maintaining the tables required for business application functions in a unified manner in the difference comparison system through the import function, classifying data according to application information and version information, and providing pages in the difference comparison system for querying and maintaining relevant data, including adding, modifying, deleting and querying information including table names, fields, constraints and indexes; The initial data management includes: maintaining the initial data information required for business application functions in a unified manner in the difference comparison system through an import function, classifying data according to application information, table information and version information, and providing pages in the difference comparison system to maintain relevant data, including the addition, modification, deletion and query of initialization data including configuration items, service information and resource information.
3. The data version difference comparison system based on the data management model according to claim 1 is characterized in that: The version management includes: maintaining the table structure and initial data of different versions of the application in a difference comparison system, viewing basic application version information through a page, combining through the version management function, and incorporating different applications into the same application group for batch release.
4. The data version difference comparison system based on the data management model according to claim 1 is characterized in that: The dependency management includes: when the application imports initial data, maintaining the dependency of the initial data not stored in its own business table, including application information, version information, dependency table information and dependency table version information; when publishing, confirming the field information in the application version configuration table according to the maintained relationship, and combining it with the configuration data to generate an insert statement.
5. The data version difference comparison system based on the data management model according to claim 1 is characterized in that: The difference comparison includes: determining the publishing environment, publishing application, target version and current version according to the publishing task, then obtaining the data management model from the application information and version information, comparing different versions of the model, identifying table structure differences, first comparing table list differences, confirming whether it is a newly added table, and then comparing the table fields, indexes, and constraint information.
6. The data version difference comparison system based on the data management model according to claim 1 is characterized in that: The script generation includes: generating a differential script according to the comparison result, wherein the first part of the script file is a table structure differential script to avoid failure during execution due to interdependence between applications, resulting in the table structure not being upgraded and data being changed first; the second part is an initial data script, including a statement for deleting all initial data of the old version and a statement for adding all initial data of the new version.
7. The data version difference comparison system based on the data management model according to claim 1 is characterized in that: The comparison history management includes: retaining the history according to the selected configuration for each comparison, opening the history page to view the comparison details and re-downloading the comparison results, and the selected configuration includes the release environment, the target version and the current version.
8. The data version difference comparison system based on the data management model according to claim 1 is characterized in that: The data publishing includes: executing the difference script through the difference comparison system and outputting the execution log; The data backup includes: confirming the list of tables to be backed up and completing the backup according to the data management model; The data rollback includes: when an exception occurs in the release, full rollback is performed through backup.
9. A data version difference comparison method based on a data management model, characterized in that: Using the data version difference comparison system based on the data management model according to any one of claims 1 to 8, the following steps are performed: Step 1: Initialize the data management model, formulate input standards, prepare the original input and import it into the data management model; Step 2: Determine the publishing environment, publishing application, target version, and current version based on the publishing task, and then obtain the corresponding data management model based on the application information and version information. Compare different versions of the data management model, identify the differences in table structures, and obtain the comparison results and table list. Step 3: Generate a table structure script based on the comparison results. According to the specific script content, modify the tables, indexes, fields, and permissions in the database. Generate corresponding delete statements based on the full initial data of the current version of the online environment, and generate corresponding add statements based on the full initial data of the target version, and replace all the data of the online environment application. Step 4: Back up related tables and data according to the table list. Roll back the entire table through the backup if an exception occurs. Track and handle script problems according to the exception log. Continue to publish data after confirming that everything is correct.
10. The data version difference comparison method based on the data management model according to claim 9 is characterized in that: The step 2 comprises: Step 2.1: Determine the list of applications to be released according to the release task, configure it as an application combination, and confirm the corresponding table list; Step 2.2: Compare different versions of the same-name table. After obtaining the table metadata information, compare the field type, length, default value, whether NULL is allowed, and field description of different versions of the table. Then compare the table index, table constraint, table primary key, and table description. Step 2.3: If there is no table with the same name in the historical version, then it is the table to be added, and all table structure information is obtained without comparison; Step 2.4: When some tables are no longer used in the new version of the business adjustment, they are the tables that need to be deleted. Migrate the data as required and keep them for a period of time before taking them offline.
Citation Information
Cited By
Modelica language-oriented model version automatic conversion method and system
CN119987844A
A model version automatic conversion method and system for Modelica language
CN119987844B
