Automatic database upgrading method and system, terminal equipment and storage medium
Through an automated database upgrade method, the SQLite database is upgraded using migration strategies, which solves the problems of cumbersome upgrade process, error-prone, inefficient and high operation and maintenance costs, and achieves efficient and secure data migration.
Patent Information
- Application Number
- CN202411331867.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2024-12-20
AI Technical Summary
The SQLite database upgrade process is cumbersome, error-prone, inefficient and high operation and maintenance costs. It mainly relies on manual operations, which increases operational complexity and time costs.
Provides an automatic database upgrade method, which can identify the processing table structure and compare the table structure by establishing a connection between the source database and the target database. It uses a migration strategy to migrate the data tables of the source database, including shared column migration, data type conversion, Ignore specific columns and default values and constraints, reduce manual intervention and improve automation upgrade efficiency.
It reduces the risk of errors during manual upgrades, improves the efficiency and security of data migration, reduces operation and maintenance costs, and ensures efficient business continuity.
Smart Images

Figure CN119166647A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of database management, and in particular to a method, system, terminal device and storage medium for automatic database upgrade. Background Art
[0002] The upgrade process of the SQLite database is generally as follows: the database administrator first exports the data in the old database to a temporary file or a backup database, then modifies the script according to the structure of the new version of the database, and manually writes SQL statements to adjust the old database structure or create a new database structure; then the administrator re-imports the exported data into the new database using the written SQL statements; finally, the administrator manually verifies the integrity and accuracy of the data.
[0003] The current SQLite database upgrade mainly relies on manual operations and script execution; however, there are the following problems:
[0004] (1) Complicated process: The entire upgrade process requires the high level of involvement of the database administrator, including multiple steps such as data export, script writing, data import and verification, which increases the complexity and time cost of the operation.
[0005] (2) Error-prone: Manual operations can easily introduce errors in data export, script writing, or data import, resulting in data loss or inconsistency.
[0006] (3) Inefficiency: The upgrade process is time-consuming and depends on the administrator's skill level, making it difficult to ensure efficient business continuity.
[0007] (4) High operation and maintenance costs: Professional database administrators are required to perform maintenance, which increases the operation and maintenance costs of the enterprise. Summary of the invention
[0008] In view of this, the embodiments of the present application provide a method, system, terminal device and storage medium for automatic database upgrade, which can effectively solve the problem that the upgrade of the SQLite database mainly relies on manual operation.
[0009] In a first aspect, an embodiment of the present application provides a method for automatically upgrading a database, comprising:
[0010] Establish a connection between the source database and the target database;
[0011] Respectively identifying and processing the source data table of the source database and the target data table of the target database to obtain source table information and target table information;
[0012] Comparing the source table information and the target table information in terms of table structure to obtain a comparison result;
[0013] According to the comparison result, a migration strategy is adopted to perform migration processing on the source data table in the source database to obtain the target data table of the target database.
[0014] In some embodiments, the source table information includes a source table name and source table structure information; the target table information includes a target table name and target table structure information; and the identifying and processing the source data table of the source database and the target data table of the target database respectively includes:
[0015] The source table name and the target table name are identified through an SQLite query statement, and the source table structure information and the target table structure information are identified through an SQLite table structure statement.
[0016] In some embodiments, the comparison result includes common column information and column data type matching information;
[0017] The common column information is column information existing in both the source data table of the source database and the target data table of the target database;
[0018] The column data type matching information is whether the column data types of the common columns are the same; if they are the same, it is identified as a column data type match; if they are not the same, it is identified as a column data type mismatch.
[0019] In some embodiments, the migration strategy is obtained by processing a rule set; the multiple migration rules in the rule set include common column migration, data type conversion, ignoring specific columns, and default values and constraints;
[0020] The common column migration is used to include the common columns of the source database and the target database into the migration scope;
[0021] The data type conversion is used to perform data type conversion on a specified column in the source database according to a preset data type conversion rule;
[0022] The Ignore Specific Columns is used to specify the column type or column name list that needs to be ignored;
[0023] The default values and constraints are used to migrate the default values and the constraints of the source database to the target database.
[0024] In some embodiments, the migration strategy is obtained by processing a set of rules, including:
[0025] Select at least two migration rules from the preset rule set;
[0026] Configure the selected migration rule to obtain the migration policy.
[0027] In some embodiments, configuring the selected migration rule to obtain the migration strategy includes:
[0028] Define the selected migration rules;
[0029] The defined migration rules are prioritized based on business requirements and data importance, and the migration strategy is obtained after prioritization.
[0030] In a second aspect, an embodiment of the present application provides a database automatic upgrade system, including a connection module, an identification module, a comparison module and a migration module;
[0031] The connection module is used to establish a connection between the source data and the target database;
[0032] The identification module is used to identify the source data table of the source database and the target data table of the target database respectively to obtain source table information and target table information;
[0033] The comparison module is used to compare the source table information and the target table information to obtain a comparison result;
[0034] The migration module is used to perform migration processing on the source data table in the source database by adopting a migration strategy according to the comparison result to obtain the target data table of the target database.
[0035] In some embodiments, the migration module includes a selection unit and a configuration unit;
[0036] The selection unit is used to select at least two migration rules from the rule set;
[0037] The configuration unit is used to configure the selected migration rule to obtain a migration strategy.
[0038] In a third aspect, an embodiment of the present application provides a terminal device, the terminal device comprising a processor and a memory, the memory storing a computer program, and the processor being used to execute the computer program to implement the above-mentioned database automatic upgrade method.
[0039] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed on a processor, implements the above-mentioned database automatic upgrade method.
[0040] The embodiments of the present application have the following beneficial effects:
[0041] Compared with the script modification in the prior art, the automatic database upgrade method of the present application obtains the target database by migrating the data of the source database using a migration strategy. The automated upgrade process reduces manual intervention and reduces the risk of errors that may occur in the manual upgrade process, thereby improving the efficiency and security of data migration. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 A flowchart showing automatic database upgrade in an embodiment of the present application is shown;
[0044] Figure 2 A flow chart of obtaining a migration strategy in an embodiment of the present application is shown;
[0045] Figure 3 A schematic diagram of a process for configuring migration rules in an embodiment of the present application is shown;
[0046] Figure 4 A structural schematic diagram of the database automatic upgrade system in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0047] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0048] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0049] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or a combination of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.
[0050] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0051] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0052] The automatic database upgrade process of the present application is based on SQLite statements to process the source data and target database for establishing connections, which can quickly realize the automatic upgrade of the device database configuration table or batch upgrade of the device database, greatly avoiding errors caused by manual migration or reducing the development workload of using scripts to write migration strategies; especially in various system upgrade and update scenarios, it greatly avoids various anomalies caused by system update database migration failures, resulting in situations such as game suspension or unavailability of transportation such as trains and airplanes.
[0053] The automatic database upgrade method is described below in conjunction with some specific embodiments.
[0054] Figure 1 A flow chart of the automatic database upgrade method according to an embodiment of the present application is shown.
[0055] Exemplarily, the database automatic upgrade method includes the following steps:
[0056] S100, establishing a connection between the source database and the target database.
[0057] The present application integrates a connection module in the industrial acquisition gateway, which automatically configures and establishes a connection between the source database and the target database to facilitate subsequent automatic updating of the database structure and data migration.
[0058] The source database of the present application includes at least one source data table, and the target database also includes at least one target data table. In one specific embodiment, the source database includes 2 source data tables, and in another specific embodiment, the target database includes 1 or 3 target data tables;
[0059] To ensure the reliability of the connection, use the connection string and credentials to verify whether the source database and the target database are connected successfully. If the connection fails, the current upgrade ends and you need to reconnect.
[0060] S200, identifying and processing a source data table of a source database and a target data table of a target database to obtain source table information and target table information respectively.
[0061] In the embodiment of the present application, taking the example that the source database includes a source data table and the target database includes a target data table, the automatic upgrade process of the database is described in detail.
[0062] Specifically, the source table information of the source data table includes the source table name and the source table structure information corresponding to the source table name; the target table information of the target data table includes the target table name and the target table structure information corresponding to the target table name. The source table structure information and the target structure information are both column names, such as name, score, or ranking.
[0063] This application executes SQLite statements through the built-in SQL parser in the industrial acquisition gateway to start querying the source data table and the target data table. In other words, the source table name and the target table name are identified through the SQLite query statement, and the source table structure information and the target table structure information are identified through the SQLite table structure statement.
[0064] This application stores the identified source table information and target table information in the gateway's memory or temporary database to facilitate subsequent comparison.
[0065] S300, performing table structure comparison on source table information and target table information to obtain a comparison result.
[0066] The source table structure information in the source table information and the target structure information in the target table information are compared, and the comparison result includes common column information and column data type matching information, etc. For example, the identified comparison result is a table existing in both the source database and the target database and its common columns, that is, a column existing in both the source data table and the target data table. Further, for the common columns, whether the column data types are the same, if they are the same, it is identified as a column data type match, and if they are not the same, it is identified as a column data type mismatch.
[0067] S400: Based on the comparison result, a migration strategy is used to migrate the source data table of the source database to obtain a target data table of the target database.
[0068] The present application processes the rule set to obtain a migration strategy, wherein the rule set includes multiple migration rules. In the embodiment of the present application, the multiple migration rules in the rule set include common column migration, ignoring specific columns, data type conversion, and default values and constraints.
[0069] Common column migration: For common columns of the source and target databases, by default, the common columns will be included in the migration scope, unless the common columns are covered by specific exclusion rules. When a table and its common columns that exist in both the source and target databases are identified, the source table can be migrated through common column migration.
[0070] Ignore specific columns: Used to predefine a list of column types or column names to be ignored. For example, columns containing sensitive information (such as password hashes) or columns that are no longer needed in the target database (such as legacy fields) are not migrated.
[0071] Data type conversion: Convert according to preset data type conversion rules; in the embodiment of the present application, the data type conversion rules include converting VARCHAR to TEXT, INT to INTEGER, etc. When the data types of the corresponding columns in the source database and the target database are different, the data type conversion rules in the data type conversion process are used to handle the data type mismatch. As another implementation method, the present application can also mark the columns with mismatched data types as errors and skip the migration of these columns when the data types do not match.
[0072] Default values and constraints: Constraints and default values should be migrated from the source database to the target database as much as possible to maintain data integrity and accuracy. This is because the default values, non-null constraints, unique constraints, etc. of the columns need to be considered during the migration process; that is, the constraints include non-null constraints and unique constraints.
[0073] In a specific embodiment of the present application, the rule set is processed according to the comparison result to obtain a migration strategy, such as Figure 2 As shown, including:
[0074] S410: Select at least two migration rules from a rule set.
[0075] In the embodiment of the present application, a migration rule is selected from a rule set, and common column migration, ignoring specific columns, data type conversion, and default values and constraints are exemplarily selected. As other implementations, common column migration and default values and constraints, or common column migration, ignoring specific columns, and default values and constraints may also be selected.
[0076] S420: Configure the selected migration rule to obtain a migration strategy.
[0077] In the embodiment of the present application, the selected migration rule is configured to obtain a migration strategy, such as Figure 3 As shown, including:
[0078] S421, defining the selected migration rule;
[0079] The selected migration rules are defined. Exemplary definitions of different migration rules are described as follows:
[0080] Common column migration: Users can choose to migrate all common columns by default, or adjust them manually as needed. For example, if a common column is no longer needed in the target database, users can exclude it from the migration list.
[0081] Ignore specific columns: Users can define an "Ignore columns" list containing column names or column types that they do not want to migrate. For example, columns containing sensitive information (such as passwords, personally identifiable information, etc.) or legacy columns that do not have a corresponding mapping in the target database.
[0082] Data type conversion: For columns with mismatched data types, users can predefine conversion rules; if certain conversions may cause data loss or precision issues, administrators can also choose to skip the migration of these columns.
[0083] Default values and constraints: Users can choose whether to migrate column default values, non-null constraints, and unique constraints. For business-critical data columns, it is very important to maintain the integrity of these constraints.
[0084] S422, the defined migration rules are prioritized according to business requirements and data importance, and a migration strategy is obtained after prioritization.
[0085] Users can set the migration priority of columns based on business needs and data importance. For example, columns with critical business data can be set to high priority, while columns with auxiliary information can be set to low priority. During the migration process, high-priority columns will be processed first to ensure smooth migration of core business data.
[0086] As another implementation method, the migration strategy also requires user interaction, that is, in some cases, users may need to interact to make decisions. For example, when encountering column differences that cannot be automatically processed, the difference details can be displayed to the user and the user can be asked to confirm the migration strategy. Users can interact through the gateway's management interface or API interface.
[0087] The final migration strategy includes the migration instructions for each table, the columns to be migrated and their conversion rules, error handling strategies, etc. The migration strategy will be stored in the storage medium of the industrial gateway in a machine-readable form (such as JSON, XML, etc.) for subsequent data use in the migration execution process.
[0088] When adopting the migration strategy to migrate the source data table in the source database to obtain the target data table, the application specifically utilizes the database transaction management capability of the industrial gateway to execute the ATTACH DATABASE command and the INSERT OR REPLACE statement in the same transaction to achieve batch migration of data. Among them, the ATTACH DATABASE command is understood as inserting if it does not exist and updating if it exists. The application uses the INSERT OR REPLACE statement to ensure the consistency and integrity of the data during the migration process. The migration process reduces manual intervention and shortens the upgrade time through automated processes, thereby improving upgrade efficiency, and automatic upgrades reduce the risk of errors.
[0089] This application implements error handling and rollback mechanisms during the migration process to ensure the integrity and consistency of data migration; that is, when an error occurs in the migration, the migration is resumed before the migration is started. This application can further reduce errors and error risks during the upgrade process through error handling strategies and verification mechanisms, thereby ensuring the efficiency and security of data migration during the data migration process and reducing data inconsistencies caused by migration failures.
[0090] After the migration is completed, the industrial gateway will automatically execute the DETACH DATABASE command to release resources, and verify the data integrity and structural correctness of the target database by executing a series of verification queries (such as SELECT COUNT(*) FROM table;) to ensure the upgrade is successful. This application can ensure that resources are effectively released and verify the accuracy of the migration results to improve user trust.
[0091] This application sends the upgrade completion notification and upgrade result report to the user after verification. If an error occurs, a detailed error log and solution suggestions are provided; further improving the user experience, helping users quickly understand the upgrade results and deal with potential problems.
[0092] Figure 4 A schematic diagram of the structure of the automatic database upgrade system of the embodiment of the present application is shown. Exemplarily, the automatic database upgrade system includes a connection module, an identification module, a comparison module and a migration module;
[0093] The connection module is used to establish a connection between the source data and the target database;
[0094] The identification module is used to identify the source data table of the source database and the target data table of the target database respectively to obtain source table information and target table information;
[0095] The comparison module is used to compare the source table information and the target table information to obtain the comparison result;
[0096] The migration module is used to migrate the source data table in the source database using the migration strategy according to the comparison result to obtain the target data table in the target database.
[0097] In some embodiments, the connection module of the present application is integrated into an industrial acquisition gateway, and the connection module automatically configures and establishes a connection between a source database and a target database to facilitate subsequent automatic updating of the database structure and data migration.
[0098] In some embodiments, the identification module of the present application executes SQLite statements through the SQL parser built into the industrial acquisition gateway to respectively identify and process the source data table of the source database and the target data table of the target database, thereby obtaining source table information and target table information.
[0099] In some embodiments, the comparison module of the present application performs table structure comparison on source table structure information in source table information and target structure information in target table information to obtain common column information and column data type matching information.
[0100] In some embodiments, the migration module of the present application includes a selection unit and a configuration unit; the selection unit is used to select at least two migration rules from a rule set; the configuration unit is used to configure the selected migration rules to obtain a migration strategy. That is, the rule set including multiple migration rules is first processed to obtain a migration strategy, and then, based on the comparison result, the migration strategy is executed on the source data table in the source database to obtain the target data table of the target database.
[0101] In a specific embodiment, assume that a large manufacturing company is using multiple industrial data collection gateways to monitor various parameters on the production line. With the development of business and system upgrades, the databases of these gateways need to be migrated to new versions to support more functions and optimize data structures. The company's IT department is responsible for configuring and executing this database migration task.
[0102] First, the IT administrator logs in to the gateway's management interface through a browser or a dedicated management tool; in the management interface, the administrator can view the table structure of the current source database, including table name, column name, data type, default value, constraints and other information.
[0103] Next, the IT administrator defines, selects, and configures the migration rules, thereby generating a migration policy.
[0104] In one embodiment, migration rules are defined, that is, common column migration, ignoring specific columns, data type conversion, default values and constraints are defined, and column migration priorities are set according to business needs and data importance. For example, columns involving key parameters of the production line are set to high priority to ensure that they are migrated first. If the system displays some column differences that cannot be automatically processed after the migration rules are defined, selected and configured, the system interacts and confirms with the user before generating the migration strategy. That is, before generating the migration strategy, the system may display some column differences that cannot be automatically processed and require the administrator to make a decision. For example, if a column has different data types in the new database, but the administrator has not predefined conversion rules, the system may prompt the administrator to confirm whether to migrate and which conversion method to use. The IT administrator interacts through the management interface or API interface to confirm or modify the migration strategy. The system generates a detailed migration strategy based on the administrator's configuration and decision, and stores it in a machine-readable form (such as JSON, XML) in the storage medium of the industrial gateway.
[0105] Furthermore, based on the comparison result, the migration strategy is executed on the source database to obtain the target database.
[0106] In some embodiments, the administrator triggers the migration task through the management interface. The gateway uses the database transaction management capability to perform data migration, including ATTACH DATABASE commands and INSERT OR REPLACE statements. The system also implements error handling and rollback mechanisms to ensure that the original data state can be restored in case of any problems.
[0107] Finally, the system releases resources and verifies the migrated data.
[0108] In some embodiments, after the migration is completed, the industrial gateway automatically releases temporary resources and connections and performs a series of verification queries to ensure the integrity and accuracy of the data. The administrator can view the migration result report in the management interface, including the number of migrated tables, the number of columns, the amount of data successfully migrated, and any errors or warnings that occur. If the migration is successfully completed, the industrial gateway sends an upgrade completion notification and result report to the administrator through the communication module. If any problems are encountered during the migration process, the system provides detailed error logs and solution suggestions to help administrators quickly locate and solve the problems.
[0109] The configuration and selection process of this application enables users to flexibly control all aspects of data migration, ensuring that the migration process not only meets business needs but also protects the integrity and security of data.
[0110] After the migration is completed and verified, this application also sends the upgrade completion notification and upgrade result report to the user through the communication module of the gateway (such as Ethernet, 4G / 5G, etc.). If an error occurs, a detailed error log and solution suggestions are provided. This further improves the user experience and helps users quickly understand the upgrade results and deal with potential problems.
[0111] It can be understood that the system of this embodiment corresponds to the database automatic upgrade method of the above embodiment, and the optional items in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.
[0112] The present application also provides a terminal device. Exemplarily, the terminal device includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the terminal device to execute the functions of each module in the above-mentioned database automatic upgrade method or the above-mentioned database automatic upgrade device.
[0113] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.
[0114] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.
[0115] The present application also provides a computer-readable storage medium for storing the computer program used in the above-mentioned terminal device. For example, the computer-readable storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0116] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0117] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0118] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
[0119] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A method for automatically upgrading a database. It is characterized in that include: Establish a connection between the source database and the target database; Respectively identifying and processing the source data table of the source database and the target data table of the target database to obtain source table information and target table information; Comparing the source table information and the target table information in terms of table structure to obtain a comparison result; According to the comparison result, a migration strategy is adopted to perform migration processing on the source data table in the source database to obtain the target data table of the target database.
2. The automatic database upgrade method according to claim 1, It is characterized in that The source table information includes a source table name and source table structure information; the target table information includes a target table name and target table structure information; the identifying process of the source data table of the source database and the target data table of the target database respectively includes: The source table name and the target table name are identified through an SQLite query statement, and the source table structure information and the target table structure information are identified through an SQLite table structure statement.
3. The automatic database upgrade method according to claim 1, It is characterized in that The comparison result includes common column information and column data type matching information; The common column information is column information existing in both the source data table of the source database and the target data table of the target database; The column data type matching information is whether the column data types of the common columns are the same; if they are the same, it is identified as a column data type match; if they are not the same, it is identified as a column data type mismatch.
4. The automatic database upgrade method according to claim 1, It is characterized in that The migration strategy is obtained by processing a rule set; the multiple migration rules in the rule set include common column migration, data type conversion, ignoring specific columns, and default values and constraints; The common column migration is used to include the common columns of the source database and the target database into the migration scope; The data type conversion is used to perform data type conversion on a specified column in the source database according to a preset data type conversion rule; The Ignore Specific Columns is used to specify the column type or column name list that needs to be ignored; The default values and constraints are used to migrate the default values and the constraints of the source database to the target database.
5. The automatic database upgrade method according to claim 4, It is characterized in that The migration strategy is obtained by processing a set of rules, including: Select at least two migration rules from the preset rule set; Configure the selected migration rule to obtain the migration policy.
6. The automatic database upgrade method according to claim 4, It is characterized in that The step of configuring the selected migration rule to obtain the migration strategy includes: Define the selected migration rules; The defined migration rules are prioritized based on business requirements and data importance, and the migration strategy is obtained after prioritization.
7. A database automatic upgrade system, It is characterized in that It includes connection module, identification module, comparison module and migration module; The connection module is used to establish a connection between the source data and the target database; The identification module is used to identify the source data table of the source database and the target data table of the target database respectively to obtain source table information and target table information; The comparison module is used to compare the source table information and the target table information to obtain a comparison result; The migration module is used to perform migration processing on the source data table in the source database by adopting a migration strategy according to the comparison result to obtain the target data table of the target database.
8. The automatic database upgrade system according to claim 7, It is characterized in that The migration module includes a selection unit and a configuration unit; The selection unit is used to select at least two migration rules from the rule set; The configuration unit is used to configure the selected migration rule to obtain a migration strategy.
9. A terminal device, It is characterized in that The terminal device comprises a processor and a memory, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the database automatic upgrade method according to any one of claims 1 to 6.
10. A computer-readable storage medium, It is characterized in that The computer program is stored therein, and when the computer program is executed on a processor, the method for automatically upgrading a database according to any one of claims 1 to 6 is implemented.
