A method, apparatus, storage medium, and electronic device for modifying table structure.

By creating views and mapping fields in upstream and downstream databases, the data synchronization problem caused by changes in table structure was solved, achieving an efficient method for changing table structure and ensuring the continuity and stability of data synchronization.

CN116303433BActive Publication Date: 2026-06-30PINGAN YIQIANBAO E COMMERCE CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PINGAN YIQIANBAO E COMMERCE CO LTD
Filing Date
2023-02-09
Publication Date
2026-06-30

Smart Images

  • Figure CN116303433B_ABST
    Figure CN116303433B_ABST
Patent Text Reader

Abstract

This application relates to the fields of fintech, digital healthcare, and artificial intelligence. It discloses a method, apparatus, storage medium, and electronic device for modifying table structures. The method includes: acquiring first data tables and second data tables; modifying the table structure and first configuration file of the first data tables based on the view names of the first views corresponding to each first data table, the first fields to be modified, and the second fields used to replace the first fields, to obtain a first target data table and a first target configuration file; modifying the table structure and first target configuration file of the second data tables based on the view names, the first fields, and the second fields, to obtain a second target data table, thus achieving a table structure modification result that does not affect the data synchronization between the first and second data tables. This application achieves table structure modification without affecting the data synchronization between the first and second data tables, improving work efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of finance, digital healthcare, and artificial intelligence, and particularly to a method, apparatus, storage medium, and electronic device for modifying table structures. Background Technology

[0002] In traditional enterprises, most companies use backend data synchronization solutions to replace application-side data migration. Among data synchronization tools, OGG (Oracle GoldenGate) is widely used to achieve near real-time data synchronization needs between upstream and downstream systems, historical data synchronization needs, and real-time data synchronization needs for report databases.

[0003] Modifying fields in core data tables to meet upstream and downstream data synchronization needs has become a major challenge in the industry, as modifying fields can cause data synchronization problems between upstream and downstream databases.

[0004] Therefore, there is an urgent need for a method to modify table structures without affecting data synchronization between upstream and downstream databases. Summary of the Invention

[0005] In view of this, the present invention provides a method, apparatus, storage medium and electronic device for changing table structure, the main purpose of which is to solve the problem that the modification of column names of core data tables that have upstream and downstream data synchronization dependencies leads to the inability to synchronize data between upstream and downstream databases.

[0006] To address the above problems, this application provides a method for modifying table structures, including:

[0007] Obtain the first data table corresponding to each downstream database and the second data table corresponding to each upstream database;

[0008] Based on the view name of the first view corresponding to each first data table, the first fields to be changed, and the second field used to replace each first field, the table structure of each first data table and the first configuration file corresponding to the first data table are modified to obtain the first target data table and the first target configuration file corresponding to each first data table.

[0009] Based on the view name of each of the first views, each of the first fields and each of the second fields, the table structure of the second data table and the first target configuration file are modified to obtain a second target data table corresponding to the second data table, so as to obtain a table structure change result that does not affect the data synchronization between the first data table and each of the second data tables.

[0010] Optionally, before modifying the table structure of each first data table and the first configuration file corresponding to the first data table based on the view name of the pre-created first view corresponding to each first data table, each first field to be changed, and the second field used to replace each first field, the method further includes: creating a first view corresponding to each first data table, including:

[0011] Determine the table name for each of the first data tables;

[0012] Determine the view name corresponding to each of the first data tables;

[0013] Create a first view corresponding to each first data table based on each of the table names, each of the view names, each of the first fields, and each of the second fields.

[0014] Optionally, the step of creating a first view corresponding to each first data table based on each of the table names, each of the view names, each of the first fields, and each of the second fields specifically includes:

[0015] Establish a first mapping relationship between each of the table names and each of the view names;

[0016] Establish a second mapping relationship between each of the first fields and each of the second fields;

[0017] Based on each of the first mapping relationships and each of the second mapping relationships, a first view corresponding to each of the first data tables is created.

[0018] Optionally, the step of modifying the table structure of each first data table and the first configuration file corresponding to each first data table based on the view name of the pre-created first view corresponding to each first data table, each first field to be changed, and the second field used to replace each first field, to obtain a first target data table and a first target configuration file corresponding to each first data table, includes:

[0019] Suspend the first target process of the target downstream database;

[0020] Based on each of the second fields, modify each of the first fields in each of the first data tables;

[0021] In the configuration file, change the name of the first table in the target downstream database to the name of the first view;

[0022] Start the second target process of the target downstream database to obtain the first target data table corresponding to each of the first data tables.

[0023] Optionally, the step of modifying the table structure of the second data table and the first target configuration file based on the view names, first fields, and second fields of each of the first views to obtain a second target data table corresponding to the second data table includes:

[0024] Pause the second target process of the upstream database;

[0025] Based on each of the second fields, modify each of the first fields in the second data table;

[0026] Suspend the first target process of the target downstream database;

[0027] In the first target configuration file, the view name of the first view is changed to the table name of the first target data table. The first target process of the downstream database and the second target process of the upstream database are started to obtain the second target data table corresponding to the second data table.

[0028] Optionally, modifying the table name of the first data table in the target downstream database to the view name of the first view in the target configuration file includes:

[0029] Based on the first process name of the first target process, the configuration file is searched in the OGG program of the target downstream database to obtain the first configuration file corresponding to the first data table.

[0030] Modify the table name of the first data table in the first configuration file to the view name of the first view, and generate the first target configuration file.

[0031] Optionally, modifying the view name of the first view to the table name of the first target data table in the configuration file includes:

[0032] Based on the first process name of the first target process, the configuration file is searched in the OGG program of the target downstream database to obtain the first target configuration file corresponding to the first target data table.

[0033] Change the view name of the first view in the first target configuration file to the table name of the first data table.

[0034] To address the aforementioned problems, this application provides a table structure modification device, characterized in that it includes:

[0035] Acquisition module: used to acquire the first data table corresponding to each downstream database and the second data table corresponding to each upstream database;

[0036] The first modification module is used to modify the table structure of each first data table and the first configuration file corresponding to each first data table based on the view name of the first view corresponding to each first data table, each first field to be changed and the second field used to replace each first field, so as to obtain the first target data table and the first target configuration file corresponding to each first data table.

[0037] The second modification module is used to modify the table structure of the second data table and the first target configuration file based on the view name, the first field, and the second field of each of the first views, so as to obtain a second target data table corresponding to the second data table, so as to obtain a table structure change result that does not affect the data synchronization between the first data table and each of the second data tables.

[0038] To address the aforementioned problems, this application provides a storage medium storing a computer program that, when executed by a processor, implements the steps of the table structure modification method described above.

[0039] To address the aforementioned problems, this application provides an electronic device, comprising at least a memory and a processor, wherein the memory stores a computer program, and the processor, when executing the computer program in the memory, implements the steps of the table structure modification method described above.

[0040] This application obtains a first data table corresponding to a target downstream database with upstream and downstream synchronization dependencies, and a second data table corresponding to an upstream database. Based on the view name, the first field to be changed, and the second field to replace the first field of each pre-created first view corresponding to each first data table, the table structure and configuration file of each first data table are modified to obtain a first target data table corresponding to each first data table. Based on the view name, the first field, and the second field of each first view, the table structure and configuration file of the second data table are modified to obtain a second target data table corresponding to the second data table. This results in a table structure modification that does not affect the data synchronization between the first and second data tables. The table structure modification method in this application can change the table structure of the first and second data tables in upstream and downstream databases without affecting the data synchronization between the upstream and downstream databases, thus improving work efficiency.

[0041] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0042] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0043] Figure 1 This is a flowchart illustrating a method for modifying a table structure according to an embodiment of this application;

[0044] Figure 2 This is a flowchart illustrating a method for modifying a table structure according to another embodiment of this application;

[0045] Figure 3 This is a structural block diagram of a table structure modification device according to another embodiment of this application. Detailed Implementation

[0046] Various embodiments and features of this application are described herein with reference to the accompanying drawings.

[0047] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.

[0048] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0049] These and other features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.

[0050] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application.

[0051] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.

[0052] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.

[0053] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in other embodiments,” all of which may refer to one or more of the same or different embodiments according to this application.

[0054] This application provides a method for modifying a table structure, such as... Figure 1 As shown, it includes:

[0055] Step S101: Obtain the first data table corresponding to each downstream database and the second data table corresponding to each upstream database;

[0056] In the specific implementation of this step, the first data table and the second data table are data tables with data synchronization dependencies. They can be data tables in fields such as fintech, digital healthcare, and artificial intelligence, such as medical statistics tables, financial data tables, transaction data tables, etc. This application modifies the table structure of the first and second data tables without affecting the data synchronization of the first and second data tables. It will not damage the existing OGG link process, has a very low workload, and can achieve large-scale operation.

[0057] Step S102: Based on the view name of the first view corresponding to each first data table, the first fields to be changed, and the second field used to replace each first field, modify the table structure of each first data table and the first configuration file corresponding to the first data table to obtain the first target data table and the first target configuration file corresponding to each first data table.

[0058] In this step, the process begins by creating a first view for each of the first data tables, based on the table names, corresponding view names, first fields to be modified, and second fields that replace the first fields. After pausing the first target process of the downstream database, the first fields in each of the first data tables are modified based on the second fields. In the first configuration file, the table names of the first data tables in the downstream database are changed to the view names of the first views, generating a first target configuration file. The second target process of the downstream database is then started, resulting in a first target data table corresponding to the first data tables. This lays the foundation for subsequent modifications to the attributes of the second data table based on the configuration file corresponding to the first target data table.

[0059] Step S103: Modify the table structure of the second data table and the first target configuration file based on the view name, the first field and the second field of each of the first views to obtain a second target data table corresponding to the second data table, so as to obtain a table structure change result that does not affect the data synchronization between the first data table and each of the second data tables.

[0060] In this step, the second target process of the upstream database is paused; the first field of each of the first fields in the second data table is modified based on each of the second fields; the first target process of the downstream database is paused; the view name of the first view in the first target configuration file is changed to the table name of the first target data table; the first target process of the downstream database and the second target process of the upstream database are started to obtain the second target data table corresponding to the second data table.

[0061] This application obtains a first data table corresponding to a target downstream database with upstream and downstream synchronization dependencies, and a second data table corresponding to an upstream database. Based on the view name, the first field to be changed, and the second field to replace the first field of each pre-created first view corresponding to each first data table, the table structure and the first configuration file corresponding to each first data table are modified to obtain a first target data table and a first target configuration file corresponding to each first data table. Based on the view name, the first field, and the second field of each first view, the table structure and the first target configuration file of the second data table are modified to obtain a second target data table corresponding to the second data table. This results in a table structure modification result that does not affect the data synchronization between the first data table and each second data table. The table structure modification method in this application can change the table structure of the first and second data tables in the upstream and downstream databases without affecting the data synchronization between the upstream and downstream databases, thus improving work efficiency.

[0062] Another embodiment of this application provides a method for changing a table structure, such as... Figure 2 As shown, it includes:

[0063] Step S201: Obtain the first data table corresponding to each downstream database and the second data table corresponding to each upstream database;

[0064] In the specific implementation process of this step, the first data table and the second data table are data tables with data synchronization dependency. This application modifies the table structure of the first data table and the second data table without affecting the data synchronization of the first data table and the second data table.

[0065] Step S202: Create the first view corresponding to each first data table;

[0066] In the specific implementation process of this step, firstly, based on each of the first data tables, the table name corresponding to each of the first data tables is determined, such as "tab1", "tab2", "tab3", etc.; then, the view name corresponding to each of the first data tables is determined, such as "view1", "view2", "view3", etc.; then, based on each of the table names, each of the view names, each of the first fields to be changed, and the second field to replace the first field, the first view corresponding to each of the first data tables is created. Specifically, firstly, a first mapping relationship is created between each table name and each view name; for example, creating a first mapping relationship between "tab1" and "view1"; creating a first mapping relationship between "tab2" and "view2"; creating a first mapping relationship between "tab3" and "view3", etc.; then, a second mapping relationship is established between each first field and each second field; for example, changing the first field from "Name" to the second field "name"; establishing a second mapping relationship between "Name" and "name"; or changing the first field from "Address" to the second field "address", establishing a second mapping relationship between the first field "address" and the second field "address", etc.; finally, based on each of the first and second mapping relationships, a first view corresponding to each of the first data tables is created. The first view can be created using the `create view` statement, and the replacement relationship between the first and second fields is written in the created view statement based on the `as select` statement, resulting in a first view corresponding to each of the first data tables, laying the foundation for subsequent modification of the table names of the first data tables based on the view names of the first views.

[0067] Step S203: Pause the first target process of the target downstream database, and modify the fields of each first field in each first data table based on each second field;

[0068] In the specific implementation process of this step, the data link between the upstream and downstream databases is quite complex. When the table structure on the link changes simultaneously, it can lead to the risk of data loss and corruption. Therefore, to address the above problem, the method in this application allows the upstream and downstream databases to run for a transition period when the table structure changes. First, the table structure of the downstream database is changed, then the table structure of the upstream database is changed, and finally, the table structure changes of the first table of the upstream database and the second table of the downstream database are completed without disrupting the original data synchronization between the first table of the upstream database and the second table of the downstream database. Specifically, the table structure of the first table of the downstream database is changed first by pausing the first target process of the target downstream database, which is the process corresponding to the first table. Then, the table structure of the first table in the target downstream database is modified, changing the first field of the first table to the second field corresponding to the first field; for example, changing the first field "name" in the first table to the second field "name"; changing the first field "address" in the first table to the second field "address", etc.

[0069] Step S204: In the first configuration file, change the table name of the first data table of the target downstream database to the view name of the first view, start the first target process of the target downstream database, and obtain the first target data table and the first target configuration file corresponding to the first data table.

[0070] In this step, the process begins by first searching for a configuration file in the OGG program of the target downstream database based on the first process name of the first target process. This retrieves the first configuration file corresponding to the first data table. Specifically, since many processes exist within the same database environment, the process corresponding to the first data table (e.g., "oggp1") must be searched. The first configuration file storing the first data table's content is then found. The table name in this first configuration file is then modified to match the view name of the first view, generating the first target configuration file. Specifically, the object name after the "target" keyword in the program can be modified; for example, changing "tab1" to "view1". Finally, the second target process of the target downstream database is started, resulting in the modified first target data table corresponding to the first data table.

[0071] Step S205: Pause the second target process of the upstream database, and modify the fields of each of the first fields in the second data table based on each of the second fields;

[0072] In this implementation process, after the table structure of the first data table corresponding to each downstream database is changed and the operation is stable, the table structure of the second data table in the upstream database can be changed. Specifically, the table structure of the second data table in the upstream database is changed first by pausing the second target process of the upstream database, which is the process corresponding to the second data table. Then, the table structure of the second data table in the upstream database is modified, changing the first field of the second data table to the second field corresponding to the first field; for example, changing the first field "Name" to the second field "name"; changing the first field "Address" to the second field "address", etc. Directly changing the table structure of the upstream and downstream databases may cause risks such as data loss. This solution implements a transition period when the table structures of the upstream and downstream databases are different. After the table structure change in the downstream database is stable, the table structure in the upstream database is changed, making the database data more secure.

[0073] Step S206: Pause the first target process of the target downstream database; modify the view name of the first view in the first target configuration file to the table name of the first target data table, start the first target process of the target downstream database and the second target process of the upstream database, obtain the second target data table corresponding to the second data table, and obtain the table structure change result that does not affect the data synchronization between the upstream database and each of the downstream databases.

[0074] First, based on the first process name of the first target process, a configuration file search is performed in the OGG program of the target downstream database to obtain the first target configuration file corresponding to the first target data table. Specifically, the first target process name can be "oggp1". The configuration file search is performed using the first process name "oggp1" to find the content of the first target configuration file corresponding to the first target data table. Then, the view name of the first view in the first target configuration file is modified to the table name of the first data table. Specifically, the object name after the "target" keyword in the program is modified; for example, the view name "view1" of the first view after the "target" keyword is changed to the table name "tab1" of the first data table. Finally, the first target process of the target downstream database and the second target process of the upstream database are started to obtain the second target data table corresponding to the second data table. After the structural changes, the final first target data table and the second target data table have the same table structure, and the data synchronization between the first and second data tables is not affected.

[0075] This application obtains a first data table corresponding to each downstream database and a second data table corresponding to each upstream database; creates a first view corresponding to each first data table; firstly, modifies the table structure of each downstream database and the first configuration file corresponding to each first data table to obtain a first target data table and a first target configuration file corresponding to each first data table; then modifies the table structure of the upstream database and the first target configuration file to obtain a second target data table corresponding to each second data table. In this application, the final first target data table and the second target data table have the same table structure after the table structure modification, and the table structure modification is performed without affecting the data synchronization between the first and second data tables. The method in this application has low workload, can achieve large-scale data table field modification, and improves work efficiency.

[0076] Another embodiment of this application provides a table structure modification device, such as... Figure 3 As shown, it includes:

[0077] Acquisition Module 1: Used to acquire the first data table corresponding to each downstream database and the second data table corresponding to each upstream database;

[0078] First modification module 2: Based on the view name of the first view corresponding to each first data table, the first fields to be changed and the second field used to replace each first field, modify the table structure of each first data table and the first configuration file corresponding to the first data table to obtain the first target data table and the first target configuration file corresponding to each first data table.

[0079] The second modification module 3 is used to modify the table structure of the second data table and the first target configuration file based on the view name of each of the first views, each of the first fields and each of the second fields, so as to obtain a second target data table corresponding to the second data table, so as to obtain a table structure change result that does not affect the data synchronization between the first data table and each of the second data tables.

[0080] In specific implementation, the table structure modification device further includes: a first view creation module, which is specifically used to: determine the table name of each of the first data tables; determine the view name corresponding to each of the first data tables; and create a first view corresponding to each of the first data tables based on each table name, each view name, each of the first fields, and each of the second fields.

[0081] In the specific implementation process, the first view creation module is also used to: establish a first mapping relationship between each of the table names and each of the view names; establish a second mapping relationship between each of the first fields and each of the second fields; and create a first view corresponding to each of the first data tables based on each of the first mapping relationships and each of the second mapping relationships.

[0082] In the specific implementation process, the first modification module 2 is specifically used to: pause the first target process of the target downstream database; modify each of the first fields in each of the first data tables based on each of the second fields; in the first configuration file, modify the table name of the first data table of the target downstream database to the view name of the first view, and generate the first target configuration file; start the second target process of the target downstream database to obtain the first target data table corresponding to the first data table.

[0083] In the specific implementation process, the second modification module 3 is specifically used to: suspend the second target process of the upstream database; modify each of the first fields in the second data table based on each of the second fields; suspend the first target process of the target downstream database; modify the view name of the first view in the first target configuration file to the table name of the first target data table; start the first target process of the target downstream database and the second target process of the upstream database to obtain the second target data table corresponding to the second data table.

[0084] In the specific implementation process, the first modification module 2 is also used to: search for the configuration file in the OGG program of the target downstream database based on the first process name of the first target process, and obtain the first configuration file corresponding to the first data table; modify the table name of the first data table in the first configuration file to the view name of the first view, and generate the first target configuration file.

[0085] In the specific implementation process, the first modification module 3 is also used to: search for the configuration file in the OGG program of the target downstream database based on the first process name of the first target process, and obtain the first target configuration file corresponding to the first target data table; and modify the view name of the first view in the first target configuration file to the table name of the first data table.

[0086] This application obtains a first data table corresponding to each downstream database and a second data table corresponding to each upstream database; creates a first view corresponding to each first data table; firstly, modifies the table structure of each downstream database and the first configuration file corresponding to each first data table to obtain a first target data table and a first target configuration file corresponding to each first data table; then modifies the table structure of the upstream database and the first target configuration file to obtain a second target data table corresponding to each second data table. In this application, the final first target data table and the second target data table have the same table structure after the table structure modification, and the table structure modification is performed without affecting the data synchronization between the first and second data tables. The method in this application has low workload, can achieve large-scale data table field modification, and improves work efficiency.

[0087] Another embodiment of this application provides a storage medium storing a computer program, which, when executed by a processor, implements the following method steps:

[0088] Step 1: Obtain the first data table corresponding to each downstream database and the second data table corresponding to each upstream database;

[0089] Step 2: Based on the view name of the first view corresponding to each first data table, the first fields to be changed, and the second fields used to replace each first field, modify the table structure of each first data table and the first configuration file corresponding to the first data table to obtain the first target data table and the first target configuration file corresponding to each first data table.

[0090] Step 3: Modify the table structure of the second data table and the first target configuration file based on the view name, the first field, and the second field of each of the first views to obtain a second target data table corresponding to the second data table, so as to obtain a table structure change result that does not affect the data synchronization between the first data table and each of the second data tables.

[0091] In specific implementation, before the computer program is executed by the processor to modify the table structure of each first data table and the first configuration file corresponding to each first data table based on the view name of the first view corresponding to each first data table, each first field to be changed, and the second field used to replace each first field, the method further includes: before creating the first view corresponding to each first data table, the method further includes: creating the first view corresponding to each first data table, including: determining the table name of each first data table; determining the view name corresponding to each first data table; and creating the first view corresponding to each first data table based on the table name, the view name, the first field, and the second field.

[0092] In the specific implementation process, the computer program is executed by the processor to implement the creation of a first view corresponding to each first data table based on each of the table names, each of the view names, each of the first fields, and each of the second fields. Specifically, it includes: establishing a first mapping relationship between each of the table names and each of the view names; establishing a second mapping relationship between each of the first fields and each of the second fields; and creating a first view corresponding to each of the first data tables based on each of the first mapping relationships and each of the second mapping relationships.

[0093] In the specific implementation process, the computer program is executed by the processor to modify the table structure of each first data table and the first configuration file corresponding to each first data table based on the view name of the first view corresponding to each first data table, the first fields to be changed, and the second fields used to replace each first field, to obtain a first target data table and a first target configuration file corresponding to each first data table. This includes: pausing the first target process of the target downstream database; modifying each first field in each first data table based on each second field; changing the table name of the first data table of the target downstream database to the view name of the first view in the first configuration file to generate the first target configuration file; and starting the second target process of the target downstream database to obtain the first target data table corresponding to each first data table.

[0094] In the specific implementation process, the computer program is executed by the processor to modify the table structure of the second data table and the first target configuration file based on the view names, first fields, and second fields of each of the first views, to obtain a second target data table corresponding to the second data table. This includes: pausing the second target process of the upstream database; modifying each of the first fields in the second data table based on each of the second fields; pausing the first target process of the target downstream database; modifying the view name of the first view in the first target configuration file to the table name of the first target data table; starting the first target process of the target downstream database and the second target process of the upstream database to obtain a second target data table corresponding to the second data table.

[0095] In the specific implementation process, the computer program is executed by the processor to modify the table name of the first data table in the target downstream database to the view name of the first view in the first target configuration file, including: searching for the configuration file in the OGG program of the target downstream database based on the first process name of the first target process to obtain the first configuration file corresponding to the first data table; modifying the table name of the first data table in the first configuration file to the view name of the first view to generate the first target configuration file.

[0096] In the specific implementation process, the computer program is executed by the processor to modify the view name of the first view in the configuration file to the table name of the first target data table, including: searching for the configuration file in the OGG program of the target downstream database based on the first process name of the first target process to obtain the first target configuration file corresponding to the first target data table; and modifying the view name of the first view in the first target configuration file to the table name of the first data table.

[0097] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0098] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0099] The specific implementation process of the above method steps can be found in the embodiment of the above arbitrary table structure modification method, which will not be repeated here.

[0100] This application obtains a first data table corresponding to the target downstream database and a second data table corresponding to the upstream database; creates a first view corresponding to each first data table; firstly, modifies the table structure of the target downstream database and the configuration file corresponding to the first data table to obtain a first target data table corresponding to each first data table; then modifies the table structure of the upstream database and the configuration file corresponding to the second data table to obtain a second target data table corresponding to the second data table. In this application, the final first target data table and the second target data table have the same table structure after the table structure modification, and the table structure modification is performed without affecting the data synchronization between the first and second data tables. The method in this application has low workload, can achieve large-scale data table field modification, and improves work efficiency.

[0101] Another embodiment of this application provides an electronic device, which can be a server. The electronic device includes a processor, memory, a network interface, and a database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When the program is executed by the processor, it implements a table structure modification method, a server-side function or step.

[0102] In one embodiment, an electronic device is provided, which can be a client. The electronic device includes a processor, memory, a network interface, a display screen, and an input device connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with an external server via a network connection. When the program is executed by the processor, it implements a table structure modification method on the client side, providing functionality or steps.

[0103] Another embodiment of this application provides an electronic device, including at least a memory and a processor. The memory stores a computer program, and the processor, when executing the computer program in the memory, performs the following method steps:

[0104] Step 1: Obtain the first data table corresponding to each downstream database and the second data table corresponding to each upstream database;

[0105] Step 2: Based on the view name of the first view corresponding to each first data table, the first fields to be changed, and the second fields used to replace each first field, modify the table structure of each first data table and the first configuration file corresponding to the first data table to obtain the first target data table and the first target configuration file corresponding to each first data table.

[0106] Step 3: Modify the table structure of the second data table and the first target configuration file based on the view name, the first field, and the second field of each of the first views to obtain a second target data table corresponding to the second data table, so as to obtain a table structure change result that does not affect the data synchronization between the first data table and each of the second data tables. The specific implementation process of the above method steps can be found in the embodiments of the above arbitrary table structure change method, which will not be repeated here.

[0107] This application obtains a first data table corresponding to each downstream database and a second data table corresponding to each upstream database; creates a first view corresponding to each first data table; firstly, modifies the table structure of each downstream database and the first configuration file corresponding to each first data table to obtain a first target data table and a first target configuration file corresponding to each first data table; then modifies the table structure of the upstream database and the first target configuration file to obtain a second target data table corresponding to each second data table. In this application, the final first target data table and the second target data table have the same table structure after the table structure modification, and the table structure modification is performed without affecting the data synchronization between the first and second data tables. The method in this application has low workload, can achieve large-scale data table field modification, and improves work efficiency.

[0108] The above embodiments are merely exemplary embodiments of this application and are not intended to limit this application. The scope of protection of this application is defined by the claims. Those skilled in the art can make various modifications or equivalent substitutions to this application within its substance and scope of protection, and such modifications or equivalent substitutions should also be considered to fall within the scope of protection of this application.

Claims

1. A method for modifying a table structure, characterized in that, include: Obtain the first data table corresponding to each downstream database and the second data table corresponding to each upstream database; Based on the view name of the first view corresponding to each first data table, the first fields to be changed, and the second field used to replace each first field, the table structure of each first data table and the first configuration file corresponding to the first data table are modified to obtain the first target data table and the first target configuration file corresponding to each first data table. Based on the view name of each of the first views, each of the first fields and each of the second fields, the table structure of the second data table and the first target configuration file are modified to obtain a second target data table corresponding to the second data table, so as to obtain a table structure change result that does not affect the data synchronization between the first data table and each of the second data tables; The process involves modifying the table structure of each first data table and the first configuration file corresponding to each first data table based on the pre-created view name of the first view corresponding to each first data table, the first fields to be changed, and the second field used to replace each first field, to obtain a first target data table and a first target configuration file corresponding to each first data table, including: Suspend the first target process of the target downstream database; Based on each of the second fields, modify each of the first fields in each of the first data tables; In the first configuration file, the table name of the first data table in the target downstream database is changed to the view name of the first view, and the first target configuration file is generated. Start the second target process of the target downstream database to obtain the first target data table corresponding to each of the first data tables; The first configuration file is stored in the OGG program of the target downstream database.

2. The method as described in claim 1, characterized in that, Before modifying the table structure of each first data table and the first configuration file corresponding to each first data table based on the view name of the pre-created first view corresponding to each first data table, each first field to be changed, and the second field used to replace each first field, the method further includes: creating a first view corresponding to each first data table, including: Determine the table name for each of the first data tables; Determine the view name corresponding to each of the first data tables; Create a first view corresponding to each first data table based on each of the table names, each of the view names, each of the first fields, and each of the second fields.

3. The method as described in claim 2, characterized in that, The creation of the first view corresponding to each first data table based on each of the table names, each of the view names, each of the first fields, and each of the second fields specifically includes: Establish a first mapping relationship between each of the table names and each of the view names; Establish a second mapping relationship between each of the first fields and each of the second fields; Based on each of the first mapping relationships and each of the second mapping relationships, a first view corresponding to each of the first data tables is created.

4. The method as described in claim 1, characterized in that, The step of modifying the table structure of the second data table and the first target configuration file based on the view names, first fields, and second fields of each of the first views to obtain the second target data table corresponding to the second data table includes: Pause the second target process of the upstream database; Based on each of the second fields, modify each of the first fields in the second data table; Suspend the first target process of the target downstream database; In the first target configuration file, the view name of the first view is changed to the table name of the first target data table. The first target process of the downstream database and the second target process of the upstream database are started to obtain the second target data table corresponding to the second data table.

5. The method as described in claim 1, characterized in that, In the first configuration file, modifying the table name of the first data table in the target downstream database to the view name of the first view includes: Based on the first process name of the first target process, the configuration file is searched in the OGG program of the target downstream database to obtain the first configuration file corresponding to the first data table. Modify the table name of the first data table in the first configuration file to the view name of the first view, and generate the first target configuration file.

6. The method as described in claim 4, characterized in that, The step of modifying the view name of the first view to the table name of the first target data table in the first target configuration file includes: Based on the first process name of the first target process, the configuration file is searched in the OGG program of the target downstream database to obtain the first target configuration file corresponding to the first target data table. Change the view name of the first view in the first target configuration file to the table name of the first target data table.

7. A table structure modification apparatus for implementing the table structure modification method as described in any one of claims 1 to 6, characterized in that, include: Acquisition module: used to acquire the first data table corresponding to each downstream database and the second data table corresponding to each upstream database; The first modification module is used to modify the table structure of each first data table and the first configuration file corresponding to each first data table based on the view name of the first view corresponding to each first data table, each first field to be changed and the second field used to replace each first field, so as to obtain the first target data table and the first target configuration file corresponding to each first data table. The second modification module is used to modify the table structure of the second data table and the first target configuration file based on the view name, the first field, and the second field of each of the first views, so as to obtain a second target data table corresponding to the second data table, so as to obtain a table structure change result that does not affect the data synchronization between the first data table and each of the second data tables.

8. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the steps of the table structure modification method according to any one of claims 1-6.

9. An electronic device, characterized in that, It includes at least a memory and a processor, wherein the memory stores a computer program, and the processor, when executing the computer program in the memory, implements the steps of the table structure modification method according to any one of claims 1-6.