CN117850831A - Method and device for realizing multi-branch cross-version upgrading based on bypass - Google Patents

Method and device for realizing multi-branch cross-version upgrading based on bypass Download PDF

Info

Publication number
CN117850831A
CN117850831A CN202311722335.XA CN202311722335A CN117850831A CN 117850831 A CN117850831 A CN 117850831A CN 202311722335 A CN202311722335 A CN 202311722335A CN 117850831 A CN117850831 A CN 117850831A
Authority
CN
China
Prior art keywords
script
version
sql
data
sql script
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311722335.XA
Other languages
Chinese (zh)
Inventor
刘玉明
王宝
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianyi Cloud Technology Co Ltd
Original Assignee
Tianyi Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianyi Cloud Technology Co Ltd filed Critical Tianyi Cloud Technology Co Ltd
Priority to CN202311722335.XA priority Critical patent/CN117850831A/en
Publication of CN117850831A publication Critical patent/CN117850831A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention belongs to the technical field of software algorithms, and discloses a method and a device for realizing multi-branch cross-version upgrade based on a fly; based on the flyback tool, creating a corresponding SQL script for data corresponding to the application version, and carrying out version management and control on the SQL script; verifying the SQL script and recording the execution conditions of the SQL script in different deployment environments; after the verification is completed, the SQL script can be subjected to script classification management; the invention can reduce the complexity of cross-version upgrade, thereby improving the version upgrade efficiency and reducing the failure rollback rate of the version upgrade.

Description

Method and device for realizing multi-branch cross-version upgrading based on bypass
Technical Field
The invention relates to the technical field of software algorithms, in particular to a method and a device for realizing multi-branch cross-version upgrading based on a fly.
Background
The platform product version serves multiple projects, the application uses the gitmaster to unify version management, under the condition of collaborative management of multiple projects, more and more versions are generated along with iteration of the product version, multiple historical versions of each project coexist, script management and control difficulty caused by cross-version upgrading is greater and greater, upgrading operation complexity is higher and higher, meanwhile, the condition that data is missing or errors are reported is more and more caused by script execution, and the requirement on version management and control of SQL scripts is more and more urgent; when one system/product service and a plurality of projects are used, a plurality of versions are derived in the research and development process, and the products of the projects are concurrent in multiple versions; on the premise that the application is effectively controlled, the version of the database SQL script is difficult to realize, so that each version is manually checked, manually executed and abnormally manually returned; the overall release of the application is low, and the error rate and the version rollback rate are both high;
there is of course also an intelligent version control method, for example, the existing patent with the authority bulletin number CN111078258B discloses a version upgrading method and device, which includes obtaining a version upgrading file for upgrading a version of a production system, and converting sensitive information in the version upgrading file into insensitive information; version upgrade files after the sensitive information is converted into insensitive information are released so as to be used for upgrading the version of the disaster recovery system; the problem that the normal service operation of the production system is affected after the disaster recovery system acquires the sensitive information is solved; however, the technology is mainly aimed at controlling the application version, weakens the version of the database script on which the application depends, and easily causes version upgrading failure or large upgrading workload due to script problems in the process of online application;
in view of the above, the present invention proposes a method and apparatus for implementing multi-branch cross-version upgrade based on bypass to solve the above-mentioned problems.
Disclosure of Invention
In order to overcome the defects in the prior art, the invention provides the following technical scheme for achieving the purposes: a method for realizing multi-branch cross-version upgrading based on a bypass comprises the following steps:
s1: based on the flyback tool, creating a corresponding SQL script for data corresponding to the application version, and carrying out version management and control on the SQL script;
s2: verifying the SQL script and recording the execution conditions of the SQL script in different deployment environments;
s3: after the verification is completed, the SQL script can be subjected to script classification management.
Further, the method for versioning and controlling the SQL script comprises the following steps:
s101: defining a script version branch model;
s102: structuring SQL script files;
s103: the SQL script file is stored to a database.
Further, defining the script version branch model in the step S101 includes defining a version naming rule, a branch management policy, a tracking and recording policy of changes, a script merging policy, a conflict resolution policy, and a version control tool.
Further, in the step S102, the method for structuring the SQL script file includes;
based on the defined script version branch model, the SQL script file is structured, and the structured operation comprises naming, adding comments and documents, organizing SQL script file sentences according to the operation sequence and adding an error processing mechanism.
Further, the order of operations includes creating tables and views, creating stored procedures and functions, adding constraints and indexes, loading data, executing data operation statements, and managing transactions.
Further, the verification includes a grammar verification and a data verification.
Further, the method for carrying out grammar verification on the SQL script comprises the following steps:
the grammar checking of the SQL script is to check the grammar structure and normalization of the SQL script, and the grammar checking comprises checking the spelling of keywords, checking the structure of SQL sentences, checking the matching of data types and checking the existence of tables and columns.
Further, the method for performing data verification on the SQL script comprises the following steps:
a. defining and limiting a valid value range of the data in advance using constraint and verification rules;
b. before executing the script for modifying the data, adding a precondition check to verify whether preconditions required by script execution are met;
c. performing data comparison and check query;
d. writing a self-defined verification script or a storage process for verification;
e. and writing a trigger or a stored procedure in the database for verification.
Further, the deployment environment includes a development environment, a testing environment, a pre-production environment, and a production environment.
Further, the script classification management includes an upgrade script, a rollback script, and a repeatable execution script.
The method and the device for realizing multi-branch cross-version upgrading based on the fly have the technical effects and advantages that:
1. the SQL upgrade script multi-project branch and multi-version management are supported, and the cross-version one-key generation of the increment upgrade script is realized according to the appointed project and version.
2. And the verification of the grammar detection instance environment of the SQL script warehouse entry is realized, and the one-key rollback of the data version with abnormal upgrading is supported.
Drawings
FIG. 1 is a schematic diagram of a method for implementing multi-branch cross-version upgrade based on a bypass in embodiment 1 of the present invention;
FIG. 2 is a schematic diagram of an implementation of embodiment 1 of the present invention;
fig. 3 is a schematic diagram of an electronic device according to embodiment 2 of the present invention;
fig. 4 is a schematic diagram of a storage medium according to embodiment 3 of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Example 1
Referring to fig. 1, a method and an apparatus for implementing multi-branch cross-version upgrade based on a bypass according to the present embodiment include:
s1: based on the flyback tool, creating a corresponding SQL script for data corresponding to the application version, and carrying out version management and control on the SQL script;
the Flyway is an open source database version management tool; it allows developers to describe changes to the database by writing SQL scripts, such as creating tables, modifying table structures, inserting data, etc.; these SQL scripts, also known as migration scripts, are managed and applied to the database according to naming rules and version numbers; in this way, the flyback can be quickly and effectively used for iterating the database table structure, and ensures that the data tables are kept consistent when deployed in a test environment or a production environment;
the method for version control of the SQL script comprises the following steps:
s101: defining a script version branch model;
s102: structuring SQL script files;
s103: storing the SQL script file into a database;
defining script version branch model in step S101 includes defining version naming rules, branch management policies, tracking and recording policies of changes, script merging policies, conflict resolution policies, and version control tools;
version naming conventions are defined to identify and distinguish script versions of different databases, version numbers may be in numerical, date, semantic version control (e.g., semantic Versioning) or other agreed-upon formats; the branch management strategy is used for managing database scripts in different environments, common branches comprise development, test, pre-release, production and the like, and each branch has different script changing and verifying processes; the tracking and recording strategy of the change is to record and track the change of each script version, including detailed change description, change influence range, author information, submission time and the like, and record the change by using a version control tool; the script merging strategy is a merging mode of script versions on different branches; the conflict resolution strategy is a method for resolving conflict correspondence which can occur; the version control tool is a flyback tool and is used for managing script versions and branches and automatically deploying and migrating;
in step S102, the method for structuring the SQL script file includes;
based on the defined script version branch model, carrying out structuring operation on the SQL script file, wherein the structuring operation comprises naming, adding comments and documents, organizing SQL script file sentences according to an operation sequence, adding an error processing mechanism and the like; adding notes and documents for purposes of illustrating scripts, scope of influence, etc.; the order of operations includes creating tables and views, creating stored procedures and functions, adding constraints and indexes, loading data, executing data operation statements, and managing transactions;
s2: verifying the SQL script and recording the execution conditions of the SQL script in different deployment environments;
the verification includes grammar verification and data verification;
the method for carrying out grammar verification on the SQL script comprises the following steps:
the grammar checking of the SQL script is to check the grammar structure and normalization of the SQL script to ensure the grammar correctness of the SQL script; grammar checking comprises the steps of checking key word spelling, SQL sentence structure, data type matching, table and column existence and the like;
the method for carrying out data verification on the SQL script comprises the following steps:
a. defining and limiting a valid value range of the data in advance using constraint and verification rules;
b. before executing the script for modifying the data, adding a precondition check to verify whether preconditions required by script execution are met; by checking whether the relevant data exists, a specific condition is met or whether the data state meets expectations;
c. data comparison and check query are carried out: after script execution, query statements may be used to compare the data states before and after execution; for example, comparing the number of data lines before and after modification, comparing whether the value of a specific field meets expectations, or performing an aggregate query to verify the total number of data, etc.;
d. writing a custom check script or a storage process for executing more complex data check logic; this may include verification logic written according to specific business rules to ensure the validity and accuracy of the data changes;
e. writing a trigger or a storage process in a database, wherein the trigger or the storage process is used for executing self-defined data verification logic when data is changed; the data can be checked in real time when the data are changed, so that the data are ensured to meet the expected requirements;
it should be noted that, the purpose of performing grammar check and data check on the SQL script is to ensure the quality of the SQL script and the stability of the execution environment, and avoid the situation of grammar error or inconsistent data in the execution process of the script;
the deployment environment comprises a development environment, a test environment, a pre-production environment and a production environment; development environment, i.e., the environment in which a developer is used to write, test, and debug code; the test environment is the environment for performing system test, performance test, regression test and the like on the software; the pre-production environment is a mirror image similar to the production environment for final testing, verification and ready release to the production environment; the production environment is an online stable environment used by an end user, and an actual production application program is run; recording the execution conditions of SQL scripts in different deployment environments to avoid repeated execution or missing execution of the scripts;
s3: after the verification is completed, the SQL script can be subjected to script classification management;
the script classification management comprises an upgrade script, a rollback script and a repeatable execution script;
the upgrade script is used for upgrading the database structure or data from one version to another version, so that the update and change of the database are realized, and the upgrade script comprises change operations of the database, such as creating a new table, modifying the table structure, adding a new column, introducing new data and the like; to ensure that the database is updated according to a specific change plan and that the database structure and data can be kept consistent with the application version;
the upgrade script can specify items and versions, generate one-key generation in sequence and across versions, and generate an incremental upgrade script by combining with the incremental version of the application so as to realize accurate management of the SQL script;
the rollback script is used for canceling the database change made by the upgrade script and restoring the database to the previous state; when the database fails to upgrade or needs to be rolled back to a previous version, the rollback script can execute opposite operation to cancel the change made by the upgrade;
the repeatable execution script comprises a plurality of operations which can be repeatedly executed, such as initializing data, creating a storage process, triggering a trigger and the like, and the script can be executed for a plurality of times without greatly changing the state of the database and is used for processing the operations which need to be executed for a plurality of times in different environments so as to ensure that the database can be correctly initialized or configured under different situations;
referring to fig. 2, an exemplary implementation scheme is shown, in which a script file corresponding to an a item, a B item, a C item, and a D item is created, the script file may be stored in a structured manner, the a item is v1.8 version, the C item is v1.9 item, the a item and the C item may be combined in version, if an error or abnormality occurs in upgrading the B item of v1.8 version and the D item of v2.0 version, abnormal rollback may be performed, and integrity of data is ensured;
based on basic capability of an open source tool, based on SQL script version management requirements, the multi-branch cross-version management method is developed, application consistency with SQL script versions is achieved, an incremental SQL script is generated by one key according to specified project branches and specified versions, an incremental application version package is matched, script upgrading packages of the specified versions are completed rapidly, complexity of cross-version upgrading is reduced, and efficiency is improved.
Example 2
Referring to fig. 3, an electronic device 500 is also provided according to yet another aspect of the present application. The electronic device 500 may include one or more processors and one or more memories. Wherein the memory has stored therein computer readable code which, when executed by one or more processors, may perform the method and apparatus for implementing multi-branch cross-version upgrades based on bypass as described above.
The method or system according to embodiments of the present application may also be implemented by means of the architecture of the electronic device shown in fig. 3. As shown in fig. 3, the electronic device 500 may include a bus 501, one or more CPUs 502, a Read Only Memory (ROM) 503, a Random Access Memory (RAM) 504, a communication port 505 connected to a network, an input/output 506, a hard disk 507, and the like. A storage device in the electronic device 500, such as the ROM503 or the hard disk 507, may store the method and apparatus for implementing multi-branch cross-version upgrade based on the bypass provided in the present application. Further, the electronic device 500 may also include a user interface 508. Of course, the architecture shown in fig. 3 is merely exemplary, and one or more components of the electronic device shown in fig. 3 may be omitted as may be practical in implementing different devices.
Example 3
Referring to FIG. 4, a computer readable storage medium 600 according to one embodiment of the present application is shown. Computer readable storage medium 600 has stored thereon computer readable instructions. The method and apparatus for implementing multi-branch cross-version upgrade based on flyway according to embodiments of the present application described with reference to the above figures may be performed when computer readable instructions are executed by a processor. Storage medium 600 includes, but is not limited to, for example, volatile memory and/or nonvolatile memory. Volatile memory can include, for example, random Access Memory (RAM), cache memory (cache), and the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, and the like.
In addition, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, the present application provides a non-transitory machine-readable storage medium storing machine-readable instructions executable by a processor to perform instructions corresponding to the method steps provided herein, such as: method and device for realizing multi-branch cross-version upgrading based on fly. The above-described functions defined in the method of the present application are performed when the computer program is executed by a Central Processing Unit (CPU).
The above embodiments may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented in software, the above-described embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product comprises one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the processes or functions described in accordance with embodiments of the present invention are produced in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website site, computer, server, or data center to another website site, computer, server, or data center over a wired network or a wireless network. The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more sets of available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. The semiconductor medium may be a solid state disk.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely one, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Finally: the foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (10)

1. The method for realizing multi-branch cross-version upgrading based on the bypass is characterized by comprising the following steps of:
s1: based on the flyback tool, creating a corresponding SQL script for data corresponding to the application version, and carrying out version management and control on the SQL script;
s2: verifying the SQL script and recording the execution conditions of the SQL script in different deployment environments;
s3: after the verification is completed, the SQL script can be subjected to script classification management.
2. The method for implementing multi-branch cross-version upgrade based on fly according to claim 1, wherein the method for versioning management of SQL scripts comprises:
s101: defining a script version branch model;
s102: structuring SQL script files;
s103: the SQL script file is stored to a database.
3. The method of claim 2, wherein defining script version branch models in step S101 includes defining version naming rules, branch management policies, tracking and recording of changes, script merge policies, conflict resolution policies, and version control tools.
4. The method for implementing multi-branch cross-version upgrade based on fly according to claim 3, wherein in step S102, the method for structuring the SQL script file comprises;
based on the defined script version branch model, the SQL script file is structured, and the structured operation comprises naming, adding comments and documents, organizing SQL script file sentences according to the operation sequence and adding an error processing mechanism.
5. The method of claim 4, wherein the order of operations includes creating tables and views, creating stored procedures and functions, adding constraints and indexes, loading data, executing data operation statements, and managing transactions.
6. The method for implementing multi-branch cross-version upgrades based on fly of claim 5, wherein the verification comprises a syntax check and a data check.
7. The method for implementing multi-branch cross-version upgrade based on fly according to claim 6, wherein the method for performing syntax checking on the SQL script comprises:
the grammar checking of the SQL script is to check the grammar structure and normalization of the SQL script, and the grammar checking comprises checking the spelling of keywords, checking the structure of SQL sentences, checking the matching of data types and checking the existence of tables and columns.
8. The method for implementing multi-branch cross-version upgrade based on fly according to claim 7, wherein the method for performing data verification on the SQL script comprises:
a. defining and limiting a valid value range of the data in advance using constraint and verification rules;
b. before executing the script for modifying the data, adding a precondition check to verify whether preconditions required by script execution are met;
c. performing data comparison and check query;
d. writing a self-defined verification script or a storage process for verification;
e. and writing a trigger or a stored procedure in the database for verification.
9. The method for implementing multi-branch cross-version upgrades based on fly of claim 8, wherein the deployment environment comprises a development environment, a testing environment, a pre-production environment, and a production environment.
10. The method for implementing multi-branch cross-version upgrade based on flyway of claim 9, wherein the script classification management comprises an upgrade script, a rollback script, and a repeatable execution script.
CN202311722335.XA 2023-12-14 2023-12-14 Method and device for realizing multi-branch cross-version upgrading based on bypass Pending CN117850831A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311722335.XA CN117850831A (en) 2023-12-14 2023-12-14 Method and device for realizing multi-branch cross-version upgrading based on bypass

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311722335.XA CN117850831A (en) 2023-12-14 2023-12-14 Method and device for realizing multi-branch cross-version upgrading based on bypass

Publications (1)

Publication Number Publication Date
CN117850831A true CN117850831A (en) 2024-04-09

Family

ID=90537387

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311722335.XA Pending CN117850831A (en) 2023-12-14 2023-12-14 Method and device for realizing multi-branch cross-version upgrading based on bypass

Country Status (1)

Country Link
CN (1) CN117850831A (en)

Similar Documents

Publication Publication Date Title
US11288243B2 (en) Systems and methods for assessing data quality
US20170372247A1 (en) Methods, systems, and articles of manufacture for implementing software application development and releases
RU2554847C2 (en) Reference points for file system
US11640352B2 (en) Testing software and/or computing hardware design through test fragmentation into one or more discrete computing environments
WO2022134915A1 (en) Interface testing method, and computer device and computer-readable storage medium
Fu et al. Witcher: Systematic crash consistency testing for non-volatile memory key-value stores
JP2023507301A (en) Unit tests for dataflow graph components
US10747653B2 (en) Software testing systems and methods
US20130173541A1 (en) Database version management system
CN109471634B (en) Method and device for checking source code format
CN111782207B (en) Task stream code generation method, device, equipment and storage medium
GB2532232A (en) Verifying a graph-based coherency verification tool
Wei et al. Preempting flaky tests via non-idempotent-outcome tests
CN104461860A (en) Method and system for operating system (OS) verification
US8738569B1 (en) Systematic verification of database metadata upgrade
US11379465B2 (en) Autonomous self-healing application data validation using database configurations
EP2797001B1 (en) System and method for creating variants in a test database during various test stages
Gao et al. Formal verification of consensus in the taurus distributed database
CN117850831A (en) Method and device for realizing multi-branch cross-version upgrading based on bypass
Miles et al. Software resilience using kokkos ecosystem
US8856069B2 (en) Combined save and validation logic
Rüping Transform! Patterns for data migration
US11829230B2 (en) Globally unique error codes for knowledge document indexing in software systems
US20230139969A1 (en) Idempotent resource management system provisioning
Airaksinen The Effects of Testing in Software Development

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination