A method and device for controlling database version change

By obtaining and editing the version change information of database metadata, generating and sending upgrade or rollback instructions, the database version upgrade and rollback are realized, and the metadata differences of each version are maintained, solving the problem of rollback and synchronization in the existing technology, and improving the flexibility and controllability of database management.

CN111708764BActive Publication Date: 2025-03-11WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010575895.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-22
Publication Date
2025-03-11
Estimated Expiration
2040-06-22

AI Technical Summary

Technical Problem

In the prior art, the upgrade of the database version can only be controlled by maintaining static SQL incremental scripts, but the rollback of the database version cannot be controlled using incremental scripts, resulting in the inability to trace, rollback, difference comparison and synchronization of historical versions.

Method used

By obtaining the database metadata version change information, including changed metadata, upgrade statements and rollback statements, editing based on the current version metadata edited by the user, generating and sending upgrade or rollback instructions, making the database version upgrade or rollback, and maintaining the metadata differences before and after the change of each version.

Benefits of technology

It realizes the upgrade and rollback of database versions, maintains the metadata differences before and after the changes of each database version, solves the problems of inaccurate traceability, rollback, difference comparison and synchronization, and improves the flexibility and controllability of database management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111708764B_ABST
    Figure CN111708764B_ABST
Patent Text Reader

Abstract

The present invention discloses a control method and device for database change versions, including: obtaining version change information of metadata of a database, wherein the version change information includes changed metadata, upgrade statements and rollback statements, the version change information is obtained by editing the metadata of the current version of the database by a user, then adding the changed metadata to the metadata of the current version of the database and storing it as the metadata of the upgraded version, and then determining whether the database has any version of metadata, and if so, sending a first upgrade instruction to the database, wherein the first upgrade instruction includes version change information, so that the database upgrades the metadata of the current version of the database according to the upgrade statement and the changed metadata in the version change information. Database version upgrade or version rollback is implemented according to the version change information, and the difference in metadata before and after each version change of the database is maintained according to the changed metadata.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of financial technology (Fintech), and in particular to a method and device for controlling database version changes. Background Art

[0002] With the development of computer technology, more and more technologies (such as blockchain, cloud computing or big data) are being applied in the financial field. The traditional financial industry is gradually transforming into financial technology, and big data technology is no exception. However, due to the security and real-time requirements of the financial and payment industries, higher requirements are also placed on big data technology.

[0003] In the prior art, flyway can rely on the application through SDK. When the application starts, it will determine the status of the current version of the database and choose to execute a static SQL incremental script to upgrade the database to the latest status. Specifically, flyway will first establish a flyway_schema_history table in the application's database to track the version status of the database, and then store the static SQL incremental script in a specified disk directory. After the application starts, flyway will scan the incremental script path, and obtain the latest incremental script list to be executed according to the flyway_schema_history table records and incremental scripts, and then execute the incremental scripts in sequence to upgrade the database of the current application to the latest version status and update the flyway_schema_history table.

[0004] However, in the prior art, the upgrade of the database version can only be controlled by maintaining a static SQL incremental script. After the database version is upgraded, the incremental script cannot be used to control the rollback of the database version. Therefore, a method for controlling database change versions is urgently needed to solve the problem that historical versions cannot be traced, rolled back, compared and synchronized after the database version is upgraded. Summary of the invention

[0005] The embodiment of the present invention provides a method and device for controlling a database version change, which are used to implement version upgrade or version rollback of a database and maintain the difference in metadata before and after each version change of the database.

[0006] In a first aspect, an embodiment of the present invention provides a method for controlling a database change version, comprising:

[0007] Obtaining version change information of metadata of the database; the version change information includes changed metadata, upgrade statements, and rollback statements; the version change information is obtained by editing the metadata of the current version of the database by the user;

[0008] Adding the changed metadata to the metadata of the current version of the database and storing the metadata as the upgraded version;

[0009] Determine whether the database has any version of metadata, and if so, send a first upgrade instruction to the database, where the first upgrade instruction includes the version change information, so that the database upgrades the metadata of the current version of the database according to the upgrade statement in the version change information and the changed metadata.

[0010] The above technical solution obtains the metadata, upgrade statements and rollback statements of the changes between database versions according to the user editing the metadata of the current version of the database, and then modifies the changed metadata to the corresponding metadata in the metadata of the current version according to the upgrade statement, thereby obtaining the upgraded version of the database, so that the database is upgraded. Similarly, the rollback statement in the version change information is used to roll back the database, thereby realizing version upgrade or version rollback of the database, and maintaining the difference in metadata before and after the change of each version of the database according to the changed metadata.

[0011] Optionally, the method further includes:

[0012] If the database does not contain any version of metadata, a table creation statement is generated;

[0013] A second upgrade instruction is sent to the database, wherein the second upgrade instruction includes the metadata of the upgraded version and the table creation statement, so that the database creates a version metadata table in the database according to the table creation statement, and adds the metadata of the upgraded version to the version metadata table.

[0014] The above technical solution generates a corresponding table creation statement according to the metadata of the upgraded version when the database does not have any version of metadata, and sends it to the database, so that the database creates a table in the database according to the table creation statement and stores the metadata of the upgraded version, so that the database obtains the metadata of the upgraded version, thereby achieving version assignment for any database that does not have any version of metadata, so that the database obtains any version of metadata according to the user's settings, thereby improving the user experience.

[0015] Optionally, the method further includes:

[0016] Obtaining a database version rollback instruction issued by a user, wherein the database version rollback instruction includes a version to be rolled back;

[0017] Determining version change information of each version required to roll back to the version to be rolled back according to the version to be rolled back and the current version of the database;

[0018] A first rollback instruction is sent to the database, wherein the first rollback instruction includes the version change information of each version, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the rollback statements and the changed metadata in the version change information of each version.

[0019] In the above technical solution, the rollback statement is obtained based on the metadata of the changes between versions. Each change information has a corresponding rollback statement. The changed metadata is modified to the metadata of the current version of the database in sequence according to the rollback statement, and the metadata of the current version is rolled back to the metadata of the version to be rolled back in sequence, such as rolling back from version 5.0 to version 4.9, and then rolling back to version 4.8, so as to realize the rollback of the database version to the historical version of the database and maintain the difference in data between each version of the database.

[0020] Optionally, after obtaining the database version rollback instruction issued by the user, it also includes:

[0021] Determining difference metadata and difference statements between the version to be rolled back and the current version of the database according to the version to be rolled back and the current version of the database;

[0022] A second rollback instruction is sent to the database, where the second rollback instruction includes the difference metadata and the difference statement, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the difference metadata and the difference statement.

[0023] In the above technical solution, the difference metadata is based on the difference between the metadata of the version to be rolled back and the metadata of the current version. The difference statement is determined based on the version difference data and corresponds to each other. The difference metadata is modified accordingly to the metadata of the current version through the difference statement, so that the current version can be directly rolled back to the version to be rolled back, such as rolling back version 10.1 directly to version 8.7, so as to speed up the version rollback and realize historical version rollback across versions of the database.

[0024] In a second aspect, an embodiment of the present invention provides a control device for changing a database version, including:

[0025] An acquisition module is used to acquire version change information of metadata of a database; the version change information includes changed metadata, upgrade statements, and rollback statements; the version change information is obtained by editing the metadata of the current version of the database by a user;

[0026] A processing module, configured to add the changed metadata to the metadata of the current version of the database and store the metadata as the metadata of the upgraded version;

[0027] Determine whether the database has any version of metadata, and if so, send a first upgrade instruction to the database, where the first upgrade instruction includes the version change information, so that the database upgrades the metadata of the current version of the database according to the upgrade statement in the version change information and the changed metadata.

[0028] Optionally, the processing module is further used for:

[0029] If the database does not contain any version of metadata, a table creation statement is generated;

[0030] A second upgrade instruction is sent to the database, wherein the second upgrade instruction includes the metadata of the upgraded version and the table creation statement, so that the database creates a version metadata table in the database according to the table creation statement, and adds the metadata of the upgraded version to the version metadata table.

[0031] Optionally, the processing module is further used for:

[0032] The control acquisition module acquires a database version rollback instruction issued by a user, wherein the database version rollback instruction includes a version to be rolled back;

[0033] Determining version change information of each version required to roll back to the version to be rolled back according to the version to be rolled back and the current version of the database;

[0034] A first rollback instruction is sent to the database, wherein the first rollback instruction includes the version change information of each version, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the rollback statements and the changed metadata in the version change information of each version.

[0035] Optionally, the processing module is further used for:

[0036] After obtaining the database version rollback instruction issued by the user, determining the difference metadata and difference statements between the version to be rolled back and the current version of the database according to the version to be rolled back and the current version of the database;

[0037] A second rollback instruction is sent to the database, where the second rollback instruction includes the difference metadata and the difference statement, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the difference metadata and the difference statement.

[0038] In a third aspect, an embodiment of the present invention further provides a computing device, including:

[0039] A memory for storing program instructions;

[0040] The processor is used to call the program instructions stored in the memory and execute the above-mentioned control method for changing the database version according to the obtained program.

[0041] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned database change version control method. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 A schematic diagram of a system architecture provided by an embodiment of the present invention;

[0044] Figure 2 A schematic diagram of a process flow of a method for controlling a database version change provided by an embodiment of the present invention;

[0045] Figure 3 A schematic diagram of version change information provided by an embodiment of the present invention;

[0046] Figure 4 A schematic diagram of metadata changes provided by an embodiment of the present invention;

[0047] Figure 5 A schematic diagram of a method for controlling a database version change provided by an embodiment of the present invention;

[0048] Figure 6 A schematic diagram of a database version rollback provided by an embodiment of the present invention;

[0049] Figure 7 A schematic diagram of a database version rollback provided by an embodiment of the present invention;

[0050] Figure 8 A schematic diagram of the structure of a control device for changing a database version provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] Figure 1 A system architecture applicable to an embodiment of the present invention is exemplarily shown, and the system architecture includes a version management system 100 and a database 200 .

[0053] Among them, the version management system 100 is used to obtain database data, generate a copy of the database version, edit the copy according to the version upgrade information edited by the user, determine the upgraded version of the copy after the editing is completed, and generate corresponding upgrade statements and rollback statements according to the version upgrade information edited by the user, and send the version upgrade information and the corresponding upgrade statements and rollback statements to the database 200.

[0054] The database 200 is used to perform version upgrade or version rollback according to the version upgrade information and corresponding upgrade statements and rollback statements sent by the version management system 100 .

[0055] It should be noted that the above Figure 1 The structure shown is only an example and is not limited to this embodiment of the present invention.

[0056] Based on the above description, Figure 2 The method flow of a method for controlling a database version change provided by an embodiment of the present invention is exemplarily shown, and the method flow can be executed by a device for controlling a database version change.

[0057] like Figure 2 As shown in the figure, the process specifically includes:

[0058] Step 201: Obtain version change information of metadata of a database.

[0059] In an embodiment of the present invention, version change information includes changed metadata, upgrade statements and rollback statements. The version change information is obtained by editing the metadata of the current version of the database by a user, wherein the upgrade statement is used to upgrade the metadata in the current version of the database to the changed metadata so that the database is version upgraded, and the rollback statement is used to roll back the metadata in the current version of the database to the changed metadata so that the database is version rolled back.

[0060] Furthermore, the version change information is obtained after the user edits the metadata in the current version of the database. There may be multiple version change information, and each version change information has corresponding upgrade statements and rollback statements, such as Figure 3 As shown, in version 1.0, there are multiple version change information, and then the user selects the version change information to edit, such as Figure 4 As shown, Figure 4 The schematic diagram of editing metadata in version change information 1 is shown below. After the user completes editing metadata such as length or column name, click Save. The metadata edited by the user will automatically generate corresponding upgrade statements and rollback statements, and then save them to version change information 1. It should be noted that different version change information can be created in different versions. Similarly, different metadata can be modified in the version change information.

[0061] Step 202: Add the changed metadata to the metadata of the current version of the database and store it as metadata of the upgraded version.

[0062] In the embodiment of the present invention, before adding the changed metadata to the metadata of the current version of the database, it is necessary to obtain the metadata of the current version of the database in the database, and then store it as a metadata copy of the database, and then the user edits the metadata copy of the database to obtain the changed metadata, and then saves the changed metadata to the metadata copy of the database and stores it as the metadata of the upgraded version. For example, a third-party version management system copies the current version 2.0 of the database in the database, and then the version management system creates a copy based on version 2.0, and creates version change information in the copy, so that the user can edit the version change information and obtain the metadata in the version change information.

[0063] Step 203, determine whether the database has any version of metadata, and if so, send a first upgrade instruction to the database, where the first upgrade instruction includes the version change information, so that the database upgrades the metadata of the current version of the database according to the upgrade statement in the version change information and the changed metadata.

[0064] In the embodiment of the present invention, when it is determined that any version of metadata exists in the database, a first upgrade instruction is sent to the database, wherein the first upgrade instruction includes version change information, and then after the database obtains the changed metadata and upgrade statement in the version change information, the upgrade statement is executed to modify the metadata corresponding to the upgrade statement to the changed metadata, thereby realizing the version upgrade of the database. Figure 5 As shown, Figure 5An exemplary diagram of a database version upgrade is shown. After the database obtains the changed metadata and upgrade statement in the version change information 1, the upgrade statement is executed to modify the corresponding metadata length "length = 32" in the current version to "length = 20" in the version change information 1, thereby realizing the change of the database version.

[0065] Exemplarily, if the database does not have any version of metadata, a table creation statement is generated;

[0066] A second upgrade instruction is sent to the database, wherein the second upgrade instruction includes the metadata of the upgraded version and the table creation statement, so that the database creates a version metadata table in the database according to the table creation statement, and adds the metadata of the upgraded version to the version metadata table.

[0067] In an embodiment of the present invention, after determining that the database is not in a working state, all metadata of the upgraded version and the corresponding table creation statement are sent to the database, so that the database first creates a version metadata table according to the table creation statement, and then stores the metadata corresponding to the version metadata table to determine it as the version of the database.

[0068] Exemplarily, a database version rollback instruction issued by a user is obtained, where the database version rollback instruction includes a version to be rolled back;

[0069] Determining version change information of each version required to roll back to the version to be rolled back according to the version to be rolled back and the current version of the database;

[0070] A first rollback instruction is sent to the database, wherein the first rollback instruction includes the version change information of each version, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the rollback statements and the changed metadata in the version change information of each version.

[0071] In the embodiment of the present invention, after receiving the database version rollback instruction issued by the user, the metadata of the required changes of each version between the current version of the database and the version to be rolled back and the rollback statements corresponding to the changed metadata are determined, and then the metadata of the determined changes of each version and the rollback statements corresponding to the changed metadata are sent to the database in the order of change, wherein the change order is that the shorter the change time is from the current time, the earlier the sending order is. After receiving the rollback statement, the database executes the rollback statement in order, and rolls back the metadata corresponding to the rollback statement in the current version of the database to the changed metadata, thereby performing rollback until the database is rolled back to the version to be rolled back.

[0072] For example, Figure 6 As shown, Figure 6An exemplary schematic diagram of database version rollback is shown. The current version of the database is 6.5. Now the version of the database is to be rolled back to version 6.3. It is determined that there is a version 6.4 between version 6.5 of the database and version 6.3 of the database. Version 6.5 of the database is first upgraded to version 6.4 by executing version change information a and b in sequence through version 6.3, and then upgraded to version 6.5 by executing version change information c, d and e in sequence. Then, version change information e, d, c, b, a are sent to the database in the following order, so that the database rolls back the current version to version 6.4 in the order of version change information e, d, c, and then rolls back to version 6.3 in the order of version change information b and a, so as to achieve rolling back the current version of the database to the version to be rolled back.

[0073] Optionally, after obtaining the database version rollback instruction issued by the user, determining the difference metadata and difference statements between the version to be rolled back and the current version of the database according to the version to be rolled back and the current version of the database;

[0074] A second rollback instruction is sent to the database, where the second rollback instruction includes the difference metadata and the difference statement, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the difference metadata and the difference statement.

[0075] In an embodiment of the present invention, after obtaining the version to be rolled back sent by the user, the difference metadata between the two is determined based on the metadata in the stored version to be rolled back and the metadata of the stored current version, and then the corresponding SQL difference statement is determined based on the difference metadata, and then sent to the database. The database executes the SQL difference statement, and directly modifies the corresponding metadata according to the content of the SQL difference statement, and directly modifies it to the metadata in the version to be rolled back.

[0076] For example, Figure 7 As shown, the current version of the database is version 7.2. Now the user wants to roll back the database version to version 3.7. The stored version 7.2 is compared with the stored version 3.7 to obtain difference metadata and difference statements (for example, it is determined that the length of the difference metadata for version 7.2 is 30, the length of version 3.7 is 21, and the difference statement is to modify the length of version 7.2 to 21). Then, the difference metadata and difference statement are sent to the database. The database modifies the length of the metadata of its current version to 21 according to the difference statement, and directly rolls back to version 3.7, saving rollback time.

[0077] It should be noted that before sending the first version upgrade information to the database, it is also necessary to obtain the baseline version of the database.

[0078] Furthermore, the initial metadata information of the database is obtained according to the database table creation statement, and storage and maintenance are performed. Then, the stored initial metadata is used as the baseline version, a copy is created based on the baseline version, and the version change information of the user's editing of the copy is obtained, thereby obtaining the metadata of the upgraded version of the database.

[0079] In order to better explain the above technical solution, a specific example will be described below.

[0080] Example 1

[0081] The version management system executes the table creation script of the test database of the SQL database in the SQL database. After the execution is completed, the table, column and index metadata information of the test database are generated in the information database. Then the version management system queries the information database for the table, column and index metadata information of the test database, and stores it in the table after obtaining it, as shown in Table 1, Table 2 and Table 3. Table 1 is the table structure metadata record table, Table 2 is the column metadata change record table, and Table 3 is the index metadata historical version record table. Then, version 1.00 of the test database is generated according to the metadata in Table 1, Table 2 and Table 3.

[0082] Table 1

[0083]

[0084] Table 2

[0085]

[0086] Table 3

[0087]

[0088] The version management system copies version 1.00 to obtain copy 1.00, and then edits the obtained copy 1.00. The editing method is to display the version metadata information in a visual way and operate it on the page, such as Figure 3 As shown, when the user edits the copy 1.00, the version change information table is created, as shown in Figure 3 "Version change information 1" is the metadata of the changes created by replica 1.00, where each version change information corresponds to different metadata changes (including table, column and index metadata changes).

[0089] After the version change information is created, add, delete, and modify it, such as Figure 4As shown, upgrade statements and rollback statements are automatically generated during the editing process. After the changed metadata is saved, the version change information is stored in the copy 1.00 in the form of Table 4, and the copy 1.00 is determined as the version 2.00 of the database. As shown in Table 4, Table 4 is a metadata change information table.

[0090] Table 4

[0091]

[0092] According to the obtained version 2.00, the version management system can send the changed metadata of version 2.00 to multiple databases, and use the upgrade statements corresponding to the changed metadata to enable the multiple databases to execute the upgrade statements, thereby upgrading the database version 1.00 to version 2.00.

[0093] After the database version is upgraded, if the user wants to roll back the database version 2.00 to 1.00, there are two ways to do this.

[0094] Method 1

[0095] The version management system sends the metadata of the changes between versions 1.00 and 2.00 and the corresponding rollback statements to the database. The database executes the rollback statements and rolls back the metadata corresponding to the rollback statements in version 2.00 to version 1.00, thereby rolling back the database to version 1.00.

[0096] Method 2

[0097] The version management system determines the difference metadata between versions 1.00 and 2.00 and automatically generates the corresponding SQL difference statements, which are then sent to the database. The database executes the SQL difference statements and rolls back the metadata corresponding to the SQL difference statements in version 2.00 to version 1.00, thereby rolling back the database to version 1.00.

[0098] In an embodiment of the present invention, metadata of a current version of a database is edited by a user to obtain metadata, upgrade statements, and rollback statements that change between database versions. The version upgrade of the database is implemented according to the upgrade statements, and the version rollback of the database is implemented according to the rollback statements. The difference in metadata before and after the change of each version of the database is maintained according to the changed metadata.

[0099] It should be noted that according to the above technical solution, when the database version changes, whether it is an upgrade or a rollback, the upgrade statement and the rollback statement can be manually written and then sent to the server to generate a new version of the database.

[0100] However, the defect is that although the function of upgrading and rolling back the database version can be realized, it takes a lot of manpower to remember the version status of the database, manually write upgrade statements and rollback statements, and then manually connect to the specified database to execute the statements. Moreover, as time goes by, this solution cannot maintain the status and metadata differences between different versions of the database.

[0101] Therefore, the embodiment of the present invention reduces the manpower required to remember the version status of the database by automatically generating upgrade statements and rollback statements. It is no longer necessary to manually write upgrade statements and rollback statements and connect to a specified database, which reduces manpower consumption. It also solves the problem of being unable to maintain the status and metadata differences between database versions over time based on the changed metadata.

[0102] Based on the same technical concept, Figure 7 A structure provided by an embodiment of the present invention and a process that can be executed by the device are exemplarily shown.

[0103] like Figure 8 As shown, the device specifically includes:

[0104] The acquisition module 801 is used to acquire version change information of metadata of the database; the version change information includes changed metadata, upgrade statements and rollback statements; the version change information is obtained by editing the metadata of the current version of the database by the user;

[0105] Processing module 802, used to add the changed metadata to the metadata of the current version of the database, and store it as metadata of the upgraded version;

[0106] Determine whether the database has any version of metadata, and if so, send a first upgrade instruction to the database, where the first upgrade instruction includes the version change information, so that the database upgrades the metadata of the current version of the database according to the upgrade statement in the version change information and the changed metadata.

[0107] Optionally, the processing module 802 is further used for:

[0108] If the database does not contain any version of metadata, a table creation statement is generated;

[0109] A second upgrade instruction is sent to the database, wherein the second upgrade instruction includes the metadata of the upgraded version and the table creation statement, so that the database creates a version metadata table in the database according to the table creation statement, and adds the metadata of the upgraded version to the version metadata table.

[0110] Optionally, the processing module is further used in 802:

[0111] The control acquisition module 801 acquires a database version rollback instruction issued by a user, wherein the database version rollback instruction includes a version to be rolled back;

[0112] Determining version change information of each version required to roll back to the version to be rolled back according to the version to be rolled back and the current version of the database;

[0113] A first rollback instruction is sent to the database, wherein the first rollback instruction includes the version change information of each version, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the rollback statements and the changed metadata in the version change information of each version.

[0114] Optionally, the processing module 802 is further used for:

[0115] After obtaining the database version rollback instruction issued by the user, determining the difference metadata and difference statements between the version to be rolled back and the current version of the database according to the version to be rolled back and the current version of the database;

[0116] A second rollback instruction is sent to the database, where the second rollback instruction includes the difference metadata and the difference statement, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the difference metadata and the difference statement.

[0117] Based on the same technical concept, an embodiment of the present invention further provides a computing device, including:

[0118] A memory for storing program instructions;

[0119] The processor is used to call the program instructions stored in the memory and execute the above-mentioned control method for changing the database version according to the obtained program.

[0120] Based on the same technical concept, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned database change version control method.

[0121] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0122] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0123] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0124] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0125] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for controlling database version changes, characterized in that: include: Get the version change information of the database metadata; The version change information includes changed metadata, upgrade statements and rollback statements; the version change information is obtained by editing the metadata of the current version of the database by the user, and the upgrade statement and the rollback statement are generated based on the edited metadata; Adding the changed metadata to the metadata of the current version of the database and storing the metadata as the upgraded version; Determine whether the database has any version of metadata, and if so, send a first upgrade instruction to the database, the first upgrade instruction including the version change information, so that the database upgrades the metadata of the current version of the database according to the upgrade statement in the version change information and the changed metadata; Obtain a database version rollback instruction issued by a user, wherein the database version rollback instruction includes a version to be rolled back; determine version change information of each version required to roll back to the version to be rolled back according to the version to be rolled back and the current version of the database; and send a first rollback instruction to the database, wherein the first rollback instruction includes the version change information of each version, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the rollback statements and the changed metadata in the version change information of each version.

2. The method according to claim 1, characterized in that The method further comprises: If the database does not contain any version of metadata, a table creation statement is generated; A second upgrade instruction is sent to the database, wherein the second upgrade instruction includes the metadata of the upgraded version and the table creation statement, so that the database creates a version metadata table in the database according to the table creation statement, and adds the metadata of the upgraded version to the version metadata table.

3. The method according to claim 1, characterized in that After obtaining the database version rollback instruction issued by the user, it also includes: Determining difference metadata and difference statements between the version to be rolled back and the current version of the database according to the version to be rolled back and the current version of the database; A second rollback instruction is sent to the database, where the second rollback instruction includes the difference metadata and the difference statement, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the difference metadata and the difference statement.

4. A control device for changing a database version, characterized in that: include: An acquisition module is used to obtain version change information of metadata of a database; The version change information includes changed metadata, upgrade statements and rollback statements; The version change information is obtained by editing the metadata of the current version of the database by the user, and the upgrade statement and the rollback statement are generated according to the edited metadata; A processing module, configured to add the changed metadata to the metadata of the current version of the database and store the metadata as the metadata of the upgraded version; Determine whether the database has any version of metadata, and if so, send a first upgrade instruction to the database, the first upgrade instruction including the version change information, so that the database upgrades the metadata of the current version of the database according to the upgrade statement in the version change information and the changed metadata; The processing module is also used to: control the acquisition module to acquire a database version rollback instruction issued by a user, wherein the database version rollback instruction includes the version to be rolled back; determine the version change information of each version required to roll back to the version to be rolled back according to the version to be rolled back and the current version of the database; send a first rollback instruction to the database, wherein the first rollback instruction includes the version change information of each version, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the rollback statements and the changed metadata in the version change information of each version.

5. The device according to claim 4, characterized in that The processing module is also used for: If the database does not contain any version of metadata, a table creation statement is generated; A second upgrade instruction is sent to the database, wherein the second upgrade instruction includes the metadata of the upgraded version and the table creation statement, so that the database creates a version metadata table in the database according to the table creation statement, and adds the metadata of the upgraded version to the version metadata table.

6. The device according to claim 4, characterized in that The processing module is also used for: After obtaining the database version rollback instruction issued by the user, determining the difference metadata and difference statements between the version to be rolled back and the current version of the database according to the version to be rolled back and the current version of the database; A second rollback instruction is sent to the database, where the second rollback instruction includes the difference metadata and the difference statement, so that the database rolls back the version of the metadata of the database to the version to be rolled back according to the difference metadata and the difference statement.

7. A computing device, characterized in that include: A memory for storing program instructions; A processor, configured to call the program instructions stored in the memory, and execute the method according to any one of claims 1 to 3 according to the obtained program.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Software version rollback method and device, server and storage medium

    CN110321254A

  • Database upgrading method, system and device and storage medium

    CN110865829A