Database script changing method based on application release, electronic equipment and medium
The method automates the execution of database script changes by unified orchestration and logical ordering, addressing inefficiencies and errors in manual deployment processes, ensuring efficient and reliable application system releases.
Patent Information
- Application Number
- CN202510498829.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-07-15
AI Technical Summary
In the prior art, the database script change process relies on manual operations, resulting in low execution efficiency and prone to errors, and the automation and efficient continuity in the release process of application system cannot be achieved.
Provides a database script change method based on application release, filters target database instances and scripts through script orchestration pages, automatically sorts and builds execution units, generates and executes publishing plans, and realizes automated execution of database changes.
It realizes integrated orchestration and automated execution of database change processes, improves the efficiency and accuracy of the application release process, and reduces the occurrence of human errors.
Smart Images

Figure CN120316094A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer processing, and particularly to a method for database script change based on application release, an electronic device, and a medium. Background Art
[0002] With the gradual deepening of the domestic information technology innovation transformation, the usage ratio of information technology innovation (hereinafter referred to as Xinchuang) databases has been continuously increasing. The SQL syntax and execution tools of various Xinchuang databases are different. For medium and large enterprises, it is very common to use multiple databases simultaneously. However, each database vendor only provides management tools that support its own database, which greatly affects the efficiency of database operation and maintenance and application system release. As the enterprise scale expands, the requirement for business continuity also increases accordingly. How to avoid errors during the release process of the application system and minimize the service interruption time caused by the release has become an important restricting factor for the operation and maintenance release tool.
[0003] Generally speaking, the deployment process of an application system mainly includes the following stages: First, submit the content required for deployment, which usually includes program packages, images, configuration files, and database scripts. Then, pause all or part of the application services as needed. After that, execute the database change script, which may include Data Definition Language (DDL) and Data Manipulation Language (DML). Subsequently, update the application package or release a new container image. Finally, restart the application service.
[0004] Currently, in the link of executing the database change script, technical reliance on manual operation is still required. Therefore, once the database script change is involved in the deployment process, all steps cannot be completed in one go. This usually requires a combination of multiple tools to complete the entire deployment process. This approach has a significant negative impact on the execution efficiency and is prone to errors due to human negligence. Summary of the Invention
[0005] In view of this, this application provides a method for database script change based on application release, an electronic device, and a medium, which can support the integrated orchestration of the database change process and realize the automatic execution of database changes during the application release process.
[0006] In a first aspect, this application provides a method for database script change based on application release, including:
[0007] Obtain the database change script of the application to be released;
[0008] Output a script arrangement page; wherein, the script arrangement page includes a database instance selection area and a database script selection area; the database instance selection area is used to screen a target database instance from multiple pre-configured database instances; the database script selection area is used to screen a to-be-executed database change script on the target database instance from the database change scripts;
[0009] When a screening completion operation is detected, sort the target database instance and the to-be-executed database change script to obtain a sorting result;
[0010] Construct one or more execution units according to the sorting result and determine the execution order of each execution unit;
[0011] Generate and execute a release plan according to the one or more execution units and the execution order.
[0012] In one embodiment, each execution unit at least includes the following execution information: any target database instance, all to-be-executed data change scripts on the any target database instance, and the sorting of the all to-be-executed data change scripts.
[0013] In one embodiment, the generating a release plan according to the one or more execution units and the execution order includes: displaying a release plan configuration page, the release plan configuration page includes a process arrangement area and a task configuration area, and the process arrangement area sequentially displays identifiers corresponding to each execution unit according to the execution order; obtaining plan execution information through the task configuration area, the plan execution information includes one or more of the following information: execution time, execution user, execution method, and plan name; when a configuration completion operation is detected, generate a release plan according to the plan execution information, the one or more execution units, and the execution order.
[0014] In one embodiment, the method further includes: when a trigger operation for a target identifier in the process arrangement area is detected, display an execution unit adjustment page, and the execution unit adjustment page is used to input management operations for the execution information of the execution unit corresponding to the target identifier, and the management operations include: adding or deleting a database instance and a database script running on the database instance.
[0015] In one embodiment, the executing the release plan includes: splitting one or more execution units in the release plan into one or more execution commands, and the execution information is included in the execution commands; sending the one or more execution commands to a script executor; obtaining and displaying the execution result of the script executor.
[0016] In one embodiment, after sorting the target database instance and the database change script to be executed to obtain a sorting result, the method further includes: displaying the sorting result; receiving an adjustment operation to adjust the sorting result.
[0017] In one embodiment, the database change scripts displayed in the database script selection area are scripts that have passed verification. After obtaining the database change scripts of the application to be released, the method further includes: decomposing the database change scripts into a sequence of lexical units; performing lexical analysis and syntactic analysis on the sequence of lexical units through lexical rules and syntactic rules; if both the lexical analysis and the syntactic analysis pass, it is determined that the verification of the database change scripts passes.
[0018] In one embodiment, sorting the database change script to be executed includes: obtaining the file name of the database change script to be executed, and determining the sorting of the database script to be executed under the corresponding target database instance according to the file name.
[0019] In a second aspect, the present application provides an electronic device, including:
[0020] At least one processor; and
[0021] At least one memory, storing instructions thereon, which when executed alone or jointly by the at least one processor, cause the electronic device to execute the method as described in the first aspect.
[0022] In a third aspect, the present application provides a computer storage medium, storing instructions thereon, which when executed alone or jointly by at least one processor of an electronic device, cause the electronic device to execute the method as described in the first aspect.
[0023] The database script change method provided by the present application can obtain the database change scripts of the application to be released and output a script orchestration page. The user can filter the target database instance and the database change scripts to be executed on the target database instance through the script orchestration page. Further, the order of the target database instance and the database change scripts to be executed can be automatically orchestrated to obtain a sorting result, and one or more execution units can be constructed according to the sorting result and the execution order of each execution unit can be determined. Subsequently, a release plan is generated and executed according to the execution order of one or more execution units, thereby realizing the automated execution of database changes during the application release process. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings are provided to provide a further understanding of the present application, and they are incorporated into and constitute a part of this application. The accompanying drawings illustrate embodiments of the present application and, together with this specification, serve to explain the principles of the present application. In the accompanying drawings:
[0025] Figure 1 It is a schematic flowchart of a method for changing a database script based on application release provided by an embodiment of the present application;
[0026] Figure 2 It is a schematic diagram of a script orchestration page provided by an embodiment of the present application;
[0027] Figure 3 It is a schematic diagram of an execution unit construction page provided by an embodiment of the present application;
[0028] Figure 4 It is a schematic diagram of a release plan configuration page provided by an embodiment of the present application;
[0029] Figure 5a It is a schematic diagram of the EBNF rules of MYSQL provided by an embodiment of the present application;
[0030] Figure 5b It is a schematic diagram of the EBNF rules of PostgreSQL provided by an embodiment of the present application;
[0031] Figure 6 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0032] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some examples or embodiments of the present application. For those of ordinary skill in the art, without creative efforts, the present application can also be applied to other similar scenarios based on these drawings. Unless obvious from the language context or otherwise stated, the same reference numerals in the figures represent the same structure or operation.
[0033] As shown in the present application, unless the context clearly indicates an exceptional situation, words such as "a", "an", "one", and / or "the" do not specifically refer to the singular and may also include the plural. Generally speaking, the terms "include" and "comprise" only indicate the inclusion of the clearly identified steps and elements, and these steps and elements do not constitute an exclusive list. The method or device may also include other steps or elements.
[0034] Meanwhile, specific terms are used in this application to describe the embodiments of this application. For example, "one embodiment", "an embodiment", and / or "some embodiments" mean a certain feature, structure, or characteristic related to at least one embodiment of this application. Therefore, it should be emphasized and noted that the "one embodiment" or "an embodiment" or "an alternative embodiment" mentioned twice or more at different positions in this specification does not necessarily refer to the same embodiment. In addition, certain features, structures, or characteristics in one or more embodiments of this application can be combined appropriately.
[0035] Unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions, and numerical values set forth in these embodiments do not limit the scope of this application. At the same time, it should be understood that, for the sake of convenience of description, the dimensions of the various parts shown in the drawings are not drawn in actual proportional relationship. Technologies, methods, and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the said technologies, methods, and devices should be regarded as part of the specification. In all the examples shown and discussed here, any specific value should be construed as merely exemplary and not as a limitation. Therefore, other examples of the exemplary embodiments may have different values. It should be noted that like reference numerals and letters denote like items in the following drawings, and thus, once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings.
[0036] In addition, although the terms used in this application are selected from well-known and commonly used terms, some of the terms mentioned in the specification of this application may be selected by the applicant according to his or her judgment, and their detailed meanings are described in the relevant parts of the description herein. In addition, it is required to understand this application not only through the actual terms used, but also through the meaning implied by each term.
[0037] Flowcharts are used in this application to illustrate the operations performed by the apparatus or device according to the embodiments of this application. It should be understood that the operations before or below do not necessarily need to be executed precisely in sequence. On the contrary, they can be executed in reverse order or simultaneously. At the same time, other operations can be added to these processes, or one or several steps of operations can be removed from these processes.
[0038] See Figure 1 , this application proposes a method for database script change based on application release, which can be applied to an application release management platform. The method includes the following steps:
[0039] S100: Obtain the database change script of the application to be released.
[0040] In one embodiment, when an application version is to be released, the user can submit all the scripts related to the to-be-released version in advance, including database change scripts. The specific submission method can be through a visual page or by importing through local configuration. This application does not make specific limitations on this. Among them, the database change script is an SQL script specifically used to record and manage database structure or data changes, emphasizing version control and automated execution.
[0041] S101: Output a script orchestration page. Among them, the script orchestration page includes a database instance selection area and a database script selection area. The database instance selection area is used to screen the target database instance from multiple pre-configured database instances, and the database script selection area is used to screen the to-be-executed database change scripts on the target database instance from the database change scripts submitted this time.
[0042] In one embodiment, multiple pre-configured database instances can be used to manage different types of databases, including various domestic information technology innovation databases and mainstream databases. For example, eight domestic information technology innovation databases including OCEANBASE-ORACLE, OCEANBASE-MYSQL, TDSQL-PG, TDSQL-MYSQL, DM, HOLOGRESS, ADB, and GaussDB, as well as four mainstream databases such as ORACLE, MYSQL, MONGDB, and PG.
[0043] S102: When the screening completion operation is detected, sort the target database instance and the to-be-executed database change scripts to obtain a sorting result.
[0044] In one embodiment, the above sorting of the to-be-executed database change scripts can be: obtain the file name of the to-be-executed database change script, and determine the sorting of the to-be-executed database script under the corresponding target database instance according to the file name.
[0045] Specifically, this application can pre-configure the priority sorting of different script types. For example, the script type priority is DDL→DML. By identifying the file name prefix of each to-be-executed database change script, determine the script type of each script and its sorting in the corresponding script type, and then complete the sorting of all to-be-executed database change scripts according to the priority of the script type and the sorting of each script under its corresponding target script type.
[0046] Exemplarily, assume that the to-be-executed database change scripts are as shown in Table 1, and the pre-configured script type priority is DDL→DML. According to the script type priority, Script 1 and Script 2 are sorted in front of Script 3. Then, according to the last digit of the file prefix of Script 1 and Script 2, the sorting result of each script is: Script 1→Script 2→Script 3.
[0047] Table 1
[0048] Script File Prefix Script 1 pro_coverage_ddl_1 Script 2 pro_coverage_ddl_2 Script 3 pro_coverage_dml_1
[0049] In one embodiment, after sorting the target database instance and the database change script to be executed to obtain a sorting result, the sorting result can also be displayed, and an adjustment operation can be received to adjust the sorting result.
[0050] Among them, the input methods of the above-mentioned screening completion operation and the above-mentioned adjustment operation can be touch (such as clicking, swiping, dragging, etc.), voice, etc., and the present application does not make specific limitations on this.
[0051] Exemplarily, the script orchestration page is as Figure 2 shown, including a database instance selection area 200 and a database script selection area 201. The database instance selection area 200 displays database instances for managing different databases and corresponding account information. After the user screens instance 1 as the first target database instance, scripts 1, 2, 3, 4, 5, 6, and 7 executed in instance 1 are screened in the database script selection area 201. After the screening is completed, the user clicks the "Add to be executed" button (that is, input the screening completion operation). The platform can first automatically sort the execution order of the scripts 1-7 (i.e., the database change scripts to be executed) under instance 1 in this screening and display the sorting result in area 202. If the user is not satisfied with the automatic sorting result, the order of each script can be adjusted by dragging. Subsequently, the user can, in the same manner, select the second, third, and N1th (N1 is an integer greater than 3) database instances, as well as the database change scripts to be executed on each instance. The platform can determine the order of each instance according to the order in which the user screens the instances.
[0052] S103: Construct one or more execution units according to the sorting result, and determine the execution order of each execution unit. Among them, each execution unit at least includes the following execution information: any target database instance, all database change scripts to be executed on the any target database instance, and the sorting of all database change scripts to be executed.
[0053] In one embodiment, the platform can display a visualization page for execution unit construction. The user can bind each execution unit in the execution process to at least one target database instance according to the desired execution order. Correspondingly, all database change scripts to be executed in at least one target database instance are also automatically bound to the corresponding execution unit. Exemplarily, assuming the sorting result is as Figure 2 shown, the visualization page for execution unit construction is as Figure 3As shown, the user binds the first execution unit to Instance 1 (i.e., the target database instance). Correspondingly, all scripts 1 - 7 under Instance 1 will be bound to the first execution unit in the order determined in step S102. The execution order of each script under the first execution unit is: Script 1 → Script 2 → Script → Script 4 → Script 5 → Script 6 → Script 7, thus completing the construction of the first execution unit. By analogy, the user can continue to construct the second, third, and N2th (N2 is an integer greater than 3) execution units as needed in the same way.
[0054] S104: Generate and execute a release plan based on one or more execution units and the execution order.
[0055] In one embodiment, a release plan configuration page can be displayed. The release plan configuration page includes a process orchestration area and a task configuration area. The process orchestration area sequentially displays the identifiers corresponding to each execution unit in the execution order. The execution information of the plan is obtained through the task configuration area. The execution information of the plan includes one or more of the following information: execution time, execution user, execution method, and plan name. Further, when a configuration completion operation is detected, a release plan is generated according to the execution information of the plan, one or more execution units, and the execution order.
[0056] In one embodiment, when a trigger operation for the target identifier in the process orchestration area is detected, an execution unit adjustment page is displayed. The execution unit adjustment page is used to input management operations for the execution information of the execution unit corresponding to the target identifier. The management operations include: adding or deleting database instances and database scripts running on the database instances.
[0057] Exemplarily, the release plan configuration page is as Figure 4 shown, including a process orchestration area 400 and a task configuration area 401. The process orchestration area 400 sequentially displays the identifiers corresponding to each execution unit in the to - be - executed process: ①②③④. On the one hand, the user can click on each identifier to view the database instances and database scripts under the corresponding execution unit and input management operations for the database instances and database scripts under the execution unit as needed. On the other hand, the user can configure the plan name in the task configuration area 401, configure the execution method such as automatic execution or manual execution. If it is automatic execution, set the conditions for automatic execution, such as the automatic execution time; if it is manual execution, set who (i.e., the execution user) will execute, the earliest planned execution time, the latest planned execution time, etc. When all configurations are completed, the platform can generate a release plan according to these configuration information.
[0058] In one embodiment, one or more execution units in the release plan are split into one or more execution commands, the execution commands include the above-mentioned execution information, the one or more execution commands are sent to the script executor, and the execution result of the script executor is obtained and displayed.
[0059] Among them, as a feasible implementation manner, the present application can deploy multiple script executors on multiple devices (such as multiple servers). After splitting multiple execution units into multiple execution commands, the multiple execution commands are concurrently sent to different script executors, and different script executors execute and feedback the results.
[0060] In one embodiment, the database change scripts displayed in the database script selection area are scripts that have passed the verification. Before performing step S102, the database change scripts of the application to be released can be verified first. The verification method is as follows: decompose the database change scripts into a sequence of lexical units, and perform lexical analysis and syntactic analysis on the sequence of lexical units through lexical rules and syntactic rules. If both the lexical analysis and syntactic analysis pass, it is determined that the verification of the database change scripts passes.
[0061] For different types of databases in the present application (such as MySQL, PostgreSQL, SQL Server, Oracle, etc.), assume that a section of SQL statement in the database change script is as follows:
[0062] SELECT id,name,address FROM user WHERE name='tom'; Decompose the SQL statement into a sequence of Tokens (lexical units) and classify them into keywords, identifiers, operators, etc. The Token sequence is shown in Table 2:
[0063] Table 2
[0064] Token Type Token Value Description Keyword SELECT Query Operation Keyword Identifier id Field Name Identifier name Field Name Identifier address Field Name Keyword FROM Data Source Keyword Identifier user Table Name Keyword WHERE Condition Filtering Keyword Identifier name Field Name Operator = Equality Comparison Operator String Constant 'tom' String Value (Needs to be wrapped in single quotes) Semicolon ; Statement Terminator
[0065] Perform lexical verification on the split Token sequence through lexical rules, including the following verifications:
[0066] 1. Illegal characters: Check whether there are non-SQL reserved symbols (such as #, $, etc.); Example error: SELECT id#nameFROM user; → # is illegal.
[0067] 2. Unclosed string: Check whether the string starts and ends with single quotes; Example error: WHERE name='tom→ Missing closing single quote.
[0068] 3. Keyword spelling error: such as SELCT (should be SELECT correctly).
[0069] Construct an Abstract Syntax Tree (AST) according to the grammar rules and verify whether the statement structure is legal. The steps are as follows:
[0070] 1. SQL Syntax Template:
[0071] SELECT <field list>
[0072] FROM
[0073] [WHERE <conditional expression>];
[0074] 2. Syntax Tree Branch Matching. Construct the AST according to the Token and the syntax template as follows:
[0075] SELECT statement
[0076]
[0077] 3. Perform syntax error checking based on the AST, including:
[0078] 3.1 Missing Mandatory Clauses:
[0079] Example Error: SELECT id, name FROM user; → Missing WHERE clause (not mandatory, but report an error if required by business logic).
[0080] 3.2 Incorrect Field List Format:
[0081] Example Error: SELECT id name, address → Missing comma separation between fields.
[0082] Illegal Table Name / Field Name:
[0083] Example Error: SELECT id, nam FROM user; → Field nam does not exist (needs to be verified in combination with database metadata).
[0084] 3.3 Conditional Expression Error:
[0085] Example Error: WHERE name tom → Missing operator =.
[0086] Example Error: WHERE name = 123 → Type mismatch (string value not enclosed in quotes).
[0087] In one embodiment, the syntax requirements for SQL statements may vary among different types of databases. To be compatible with the syntax checking under different types of databases, this application can describe the SQL language structures of various databases (such as MySQL, PostgreSQL, SQL Server, Oracle, etc.) based on the Extended Backus-Naur Form (EBNF), and obtain the EBNF rules corresponding to different types of databases. After decomposing the database change script into a Token sequence, the Token sequence is matched with each EBNF rule to identify the structure of the SQL statement, thereby completing the syntax checking.
[0088] Exemplarily, the EBNF rules for MYSQL are as follows Figure 5a shown, and the Token sequence is still as shown in Table 2. The syntax checking process is as follows:
[0089] 1. SELECT clause: id, name, address conforms to the <column_list> definition.
[0090] 2. FROM clause: user is the table name. If it is not enclosed in backticks and user is a reserved word, an error will be reported.
[0091] 3. WHERE clause: name = 'tom' conforms to the <where_clause> definition.
[0092] 4. LIMIT clause: Not used, does not affect the syntax.
[0093] Another example is that the EBNF rules for PostgreSQL are as follows Figure 5b shown, and the Token sequence is still as shown in Table 2. The syntax checking process is as follows:
[0094] 1. SELECT clause: id, name, address conforms to the <column_list> definition.
[0095] 2. FROM clause: user is a reserved word. When not enclosed in double quotes, it will be parsed as the system user table, resulting in an error.
[0096] 3. WHERE clause: name = 'tom' conforms to the <where_clause> definition.
[0097] As a feasible implementation, this application supports the independent execution of the database change process and also supports the completion of the application release and the database change release in the same process. The specific implementation of the independent execution has been clearly described above and will not be elaborated here. If it is required to complete the application release and the database change release in the same process, then database release and container release can be selected when choosing the release tool on the release plan configuration page. In addition to displaying the process nodes of the database part, the process orchestration area on the release plan configuration page will also display the process nodes of the application release. Similar to the implementation method of executing the database change release, the subsequent platform can generate and execute the release plan based on the plan execution information obtained through the plan configuration page, the execution order of each process node in the process orchestration area, the script information to be executed under each process node, etc., so as to complete the application release and the database change release in the same process.
[0098] In the embodiment of this application, the database change script of the application to be released can be obtained, and the target database instance and the database change script to be executed on the target database instance are filtered through the script orchestration page. The target database instance and the database change script to be executed are sorted to obtain a sorting result, and one or more execution units are constructed according to the sorting result. The execution order of each execution unit is determined, and a release plan is generated and executed based on the one or more execution units and the execution order. By implementing this application, the integrated orchestration of the database change process can be supported, and the automatic execution of the database change during the application release process can be realized.
[0099] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of this application. As Figure 6 shown, the electronic device includes one or more processors 601, one or more memories 602 coupled to the processor 601, and one or more communication modules 600 coupled to the processor 601.
[0100] The communication module 600 is used for two-way communication. The communication module 600 has at least one antenna to facilitate communication. The communication interface can represent any interface necessary for communicating with other network elements.
[0101] The processor 601 can be of any type suitable for the local technical network, and as a non-limiting example, can include one or more of the following: general-purpose computer, special-purpose computer, microprocessor, digital signal processor (DSP), and processor based on a multi-core processor architecture. The electronic device can have multiple processors, such as an application-specific integrated circuit chip, which is clocked in time to synchronize the main processor.
[0102] The processor 601 can be used to perform the following steps: obtain the database change script of the application to be released; output a script orchestration page, where the script orchestration page includes a database instance selection area and a database script selection area; the database instance selection area is used to screen a target database instance from multiple pre-configured database instances; the database script selection area is used to screen the database change script to be executed on the target database instance from the database change script; when a screening completion operation is detected, sort the target database instance and the database change script to be executed to obtain a sorting result; construct one or more execution units according to the sorting result and determine the execution order of each execution unit; generate and execute a release plan according to the one or more execution units and the execution order.
[0103] In one embodiment, each execution unit at least includes the following execution information: any target database instance, all database change scripts to be executed on the any target database instance, and the sorting of all the database change scripts to be executed.
[0104] In one embodiment, when the processor 601 executes the step of generating a release plan according to the one or more execution units and the execution order, it is specifically used to: display a release plan configuration page, the release plan configuration page includes a process orchestration area and a task configuration area, and the process orchestration area sequentially displays the identifiers corresponding to each execution unit in the execution order; obtain plan execution information through the task configuration area, and the plan execution information includes one or more of the following information: execution time, execution user, execution method, and plan name; when a configuration completion operation is detected, generate a release plan according to the plan execution information, the one or more execution units, and the execution order.
[0105] In one embodiment, the processor 601 is further used to execute: when a trigger operation for a target identifier in the process orchestration area is detected, display an execution unit adjustment page, and the execution unit adjustment page is used to input management operations for the execution information of the execution unit corresponding to the target identifier, and the management operations include: adding or deleting a database instance and the database scripts running on the database instance.
[0106] In one embodiment, when the processor 601 executes the step of executing the release plan, it is specifically used to: split one or more execution units in the release plan into one or more execution commands, and the execution information is included in the execution commands; send the one or more execution commands to a script executor; obtain and display the execution result of the script executor.
[0107] In one embodiment, after sorting the target database instance and the database change script to be executed to obtain a sorting result, the processor 601 is further configured to display the sorting result; and receive an adjustment operation to adjust the sorting result.
[0108] In one embodiment, the database change script displayed in the database script selection area is a script that has passed verification. After obtaining the database change script of the application to be released, the processor 601 is further configured to: decompose the database change script into a sequence of lexical units; perform lexical analysis and syntactic analysis on the sequence of lexical units through lexical rules and syntactic rules; and if both the lexical analysis and the syntactic analysis pass, determine that the verification of the database change script has passed.
[0109] In one embodiment, when the processor 601 executes the step of sorting the database change script to be executed, it is specifically configured to: obtain the file name of the database change script to be executed, and determine the sorting of the database script to be executed under the corresponding target database instance according to the file name.
[0110] The memory 602 may include one or more non-volatile memories and one or more volatile memories. Examples of non-volatile memories include, but are not limited to, read-only memory (ROM) 6021, electrically programmable read-only memory (EPROM), flash memory, hard disk, optical disc (CD), digital video disc (DVD), and other magnetic and / or optical memories. Examples of volatile memories include, but are not limited to, random access memory (RAM) 6020 and other volatile memories that do not persist during a power outage.
[0111] The computer program 603 includes computer-executable instructions executed by the relevant processor 601. The computer program 603 may be stored in the ROM 6021. The processor 601 may execute any appropriate actions and processes by loading the computer program 603 into the RAM 6020.
[0112] Embodiments of the present application may be implemented by the computer program 603, such that the electronic device may execute any of the disclosed processes discussed with reference to Figure 1 The embodiments of the present application may also be implemented by hardware or by a combination of software and hardware.
[0113] In some embodiments, the computer program 603 may be tangibly embodied in a computer-readable medium, which may be included in an electronic device (e.g., the memory 602) or other storage devices accessible to the electronic device. The electronic device may load the computer program 603 from the computer-readable medium into the RAM 6020 for execution. The computer-readable medium may include any type of tangible non-volatile memory, such as ROM, EPROM, flash memory, hard disk, CD, DVD, etc. The program 603 is stored on the computer-readable medium.
[0114] Generally, the various embodiments of the present application may be implemented in hardware or dedicated circuits, software, logic, or any combination thereof. Certain aspects may be implemented in hardware, while other aspects may be implemented in firmware or software, which may be executed by a controller, a microprocessor, or other electronic devices. Although the various aspects of the embodiments of the present application are shown and described as block diagrams, flowcharts, or using some other graphical representation, it should be understood that, by way of non-limiting example, the blocks, devices, management platforms, technologies, or methods described herein may be implemented in hardware, software, firmware, dedicated circuits or logic, general-purpose hardware or controllers, or other electronic devices, or some combination thereof.
[0115] The present application also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. The computer program product includes computer-executable instructions, such as instructions included in program modules, which are executed in a device on a target real or virtual processor to perform the methods described above with reference to Figure 1 the methods described. Generally, program modules include routines, programs, libraries, objects, classes, components, data structures, etc. that perform specific tasks or implement specific abstract data types. In various embodiments, the functions of program modules may be combined or separated as needed among program modules. The machine-executable instructions for program modules may be executed within a local or distributed device. In a distributed device, program modules may be located in local and remote storage media.
[0116] The program code for performing the methods of the present application may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a dedicated computer, or other programmable data processing device, such that when the program code is executed by the processor or controller, the functions / operations specified in the flowchart and / or block diagram are implemented. The program code may be executed entirely on the machine as an independent software package, partially on the machine, partially on a remote machine, partially on a remote machine, or entirely on a remote machine or server.
[0117] In the context of the present application, the computer program code or related data can be carried by any suitable carrier to enable a device, apparatus or processor to perform the various processes and operations described above. Examples of carriers include signals, computer-readable media, etc.
[0118] The computer-readable media can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable media may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor management platforms, devices or apparatuses, or any suitable combination of the foregoing. More specific examples of the computer-readable storage medium include electrical connections with one or more wires, portable computer floppy disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0119] Furthermore, although the operations are described in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order, or that all of the operations shown be performed to obtain the desired result. In some cases, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these details should not be construed as limiting the scope of the present application, but rather can be construed as descriptions of features specific to a particular embodiment. Certain features described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, the various features described in the context of a single embodiment can also be implemented separately or in any suitable sub-combination in multiple embodiments.
[0120] Although the present application has been described in language specific to structural features and / or methodological acts, it is to be understood that the application defined in the appended claims is not necessarily limited to the specific features or acts described above. On the contrary, the specific features and acts described above are disclosed as example forms of implementing the claims.
Claims
1. A method for changing database scripts based on application release, characterized in that, The method includes: Obtaining a database change script of an application to be released; Outputting a script orchestration page; wherein, the script orchestration page includes a database instance selection area and a database script selection area; the database instance selection area is used to screen a target database instance from multiple pre-configured database instances; the database script selection area is used to screen a database change script to be executed on the target database instance from the database change script; When a screening completion operation is detected, sorting the target database instance and the database change script to be executed to obtain a sorting result; Constructing one or more execution units according to the sorting result and determining the execution order of each execution unit; Generating and executing a release plan according to the one or more execution units and the execution order.
2. The method according to claim 1, wherein Each execution unit at least includes the following execution information: any target database instance, all database change scripts to be executed on the any target database instance, and the sorting of the all database change scripts to be executed.
3. The method according to claim 1 or 2, characterized in that, The generating a release plan according to the one or more execution units and the execution order includes: Displaying a release plan configuration page, the release plan configuration page includes a process orchestration area and a task configuration area, and the process orchestration area sequentially displays identifiers corresponding to each execution unit according to the execution order; Obtaining plan execution information through the task configuration area, the plan execution information includes one or more of the following information: execution time, execution user, execution method, and plan name; When a configuration completion operation is detected, generating a release plan according to the plan execution information, the one or more execution units and the execution order.
4. The method according to claim 3, wherein The method further includes: When a trigger operation for a target identifier in the process orchestration area is detected, displaying an execution unit adjustment page, and the execution unit adjustment page is used to input management operations for the execution information of the execution unit corresponding to the target identifier, and the management operations include: adding or deleting a database instance and a database script running on the database instance.
5. The method according to claim 2, wherein The executing the release plan includes: Splitting one or more execution units in the release plan into one or more execution commands, and the execution commands include the execution information; Sending the one or more execution commands to a script executor; Obtaining and displaying the execution result of the script executor.
6. The method according to claim 1, characterized in that, After sorting the target database instance and the database change script to be executed to obtain a sorting result, the method further includes: Displaying the sorting result; Receiving an adjustment operation to adjust the sorting result.
7. The method according to claim 1, wherein The database change scripts displayed in the database script selection area are scripts that have passed verification. After obtaining the database change script of the application to be released, the method further includes: Decomposing the database change script into a sequence of lexical units; Performing lexical analysis and syntax analysis on the sequence of lexical units through lexical rules and syntax rules; If both the lexical analysis and the syntax analysis pass, it is determined that the verification of the database change script passes.
8. The method according to claim 1, wherein The sorting of the database change scripts to be executed includes: Obtain the file name of the database change script to be executed, and determine the sorting of the database script to be executed under the corresponding target database instance according to the file name.
9. An electronic device, characterized in that, Including: At least one processor; And At least one memory, on which instructions are stored, and when the instructions are executed alone or jointly by the at least one processor, the electronic device is caused to execute the method according to any one of claims 1-8.
10. A computer storage medium, characterized in that, Instructions are stored on the computer storage medium, and when the instructions are executed alone or jointly by at least one processor of the electronic device, the electronic device is caused to execute the method according to any one of claims 1-8.