Disclosure of Invention
The invention aims at solving the technical problems of the prior art, and provides a database management method, a terminal and a storage medium, wherein the database management tool is used for managing data change in a database so as to facilitate the updating or recovery of a version of the database by a developer.
The technical scheme adopted for solving the technical problems is as follows:
in a first aspect, the present invention provides a database management method, wherein the database management method includes the steps of:
acquiring input user information, and entering a corresponding management interface according to the user information and interface options selected by a user;
recording the updating operation of the user in the management interface and the updating information of the user to a database;
checking the current version of the database according to the updating operation and the updating information;
and updating the current version of the database according to the verification result, or recovering the current version of the database to the previous version.
Further, the method further comprises the following steps:
and setting user permission in advance according to the user information.
Further, the step of acquiring the input user information and entering a corresponding management interface according to the user information and the interface options selected by the user specifically comprises the following steps:
acquiring user information input by the user;
verifying the user information and determining the user authority of the user;
and acquiring the interface options selected by the user, and entering a corresponding management interface according to the interface options and the user permission.
Further, the recording the updating operation of the user in the management interface and the updating information of the user to the database specifically includes the following steps:
screening users entering the management interface according to preset conditions;
recording the update operation, update information, updated content and update time executed by the selected user;
and generating an update log according to the update operation, the update information, the updated content and the update time.
Further, the verifying the current version of the database according to the update operation and the update information specifically includes the following steps:
checking the current version of the database according to the update log, and judging whether the definition object of the database in the current version is updated or not;
if the definition object of the database in the current version is not updated, judging that the current version of the database is not abnormal;
and if the definition object of the database in the current version is updated, judging that the current version of the database is abnormal.
Further, the updating the current version of the database according to the verification result specifically includes the following steps:
searching a position corresponding to the updated content according to the update log;
setting corresponding update nodes at the searched positions;
writing the update information in the update log into the update node to update the current version of the database.
Further, the restoring the current version of the database to the previous version specifically includes the following steps:
searching the original definition object of the database according to the updated content;
and recovering the current version of the database to the previous version according to the original definition object.
Further, the management interface includes: user management interface, role management interface and node management interface.
In a second aspect, the present invention further provides a terminal, which includes a processor, and a memory connected to the processor, where the memory stores a database management program, and the database management program is used to implement the operation of the database management method according to the first aspect when executed by the processor.
In a third aspect, the present invention also provides a storage medium storing a database management program for implementing the operations of the database management method according to the first aspect when the database management program is executed by a processor.
The technical scheme adopted by the invention has the following effects:
when a user updates the database, the invention records the update operation executed by the user and the corresponding update information, thereby checking the version of the database according to the recorded information, and facilitating the update or recovery of the version of the database by a developer through managing the data change in the database.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more clear and clear, the present invention will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Example 1
In the process of software development, no matter a developer or a database operation maintainer can have a common script to be saved, the existing saving mode is to save the script in a file form through SQL format codes, and the saving mode is inconvenient for general users to use and is inconvenient for managers to conduct classified management.
In order to facilitate management of databases by a software development team, the present embodiment provides a database management method, where the database management method is applied to a terminal, and the terminal includes, but is not limited to: mobile terminals, tablets, computers, and other devices; and a management tool for managing the version of the database is installed in the terminal, and a team of software developers can manage the version of the database by using the management tool, so that an application program and the database are placed in the same version, and the problems of the published program can be traced back in the development process of the developers conveniently.
As shown in fig. 1, in one implementation manner of the present embodiment, the database management method includes the following steps:
step S100, input user information is obtained, and a corresponding management interface is entered according to the user information and interface options selected by a user.
In the process of software development, the storage process of the database version automatically covers the previous database version, so that the definition of the object of the previous database version is lost; for example, developer A creates a stored procedure "ProcA" and then developer B modifies the stored procedure "ProcA", which will be overridden by the modification made by developer B, resulting in the loss and inability to recover the previously defined stored procedure.
Through the management tool of the embodiment, all operations of a certain database can be completely recorded; by searching the operation record, the database operation executed by the operator before can be obtained; for example, it may be found that the stored procedure "ProcA" was created by developer a and the database was modified at some point by developer B.
In the process of software development, the problem of database, such as database error reporting or database performance degradation, is possibly caused by the upgrading of an application program or the modification of a database, so that the method is extremely important for the management of the version of the database; the management tool adopted in the embodiment can quickly check the difference between the current database version and the previous database version, and inquire the abnormality of the database according to specific conditions, thereby eliminating the abnormality and keeping the database running stably.
Specifically, before using the management tool, user rights of each user (i.e., a software developer) need to be set, and user information can be input into the management tool when the user rights of each user are set, wherein the user information comprises information such as a user name, a user password, a user position and the like; then, user rights to use the management tool are set according to user information input by the user, so that a manager sets operation rights of each user according to the user rights.
By setting the user authority, corresponding authorities can be distributed for different users so that each user can take part in the job, and the phenomenon of misoperation is avoided; for example: the erroneous deletion occurs because individual users do not understand the meaning of the data packets in the database.
I.e. before said step S100, the method further comprises the steps of:
and S001, setting user permission in advance according to the user information.
In this embodiment, after setting the user rights, each user may use the functions in the corresponding management interface according to his own user rights, and perform corresponding operations through the user rights; for example, modifying a database version storage path, looking up database version anomaly information, managing database versions, and the like.
Specifically, when a user logs into the management tool, user information input by the user may be acquired, and the user information may be verified, for example: verifying a user name, a user password, a user position and the like; if the user information is successfully verified, the user authority of the user is further determined according to the user information; the user permission of each preset user is searched to obtain a search result, and the user permission of the current login management tool is determined according to the search result; if the verification fails, corresponding prompt is carried out on the login interface of the management tool.
After verifying the user information and determining the user authority, acquiring an interface option selected by the user in a login interface, and entering a corresponding management interface according to the user authority and the interface option, wherein the management interface comprises: a user management interface, a role management interface and a node management interface; when a user enters a corresponding management interface, a corresponding operation may be performed in the corresponding management interface to implement a corresponding function, for example: modifying data in the database, managing information of each user, managing version of the database, and the like.
In the management tool, the user management interface may be configured to filter user information and edit user information, where the editing user information includes: newly adding, modifying and deleting user information; the role management interface can be used for setting the role (namely the role of the user) of each user, setting corresponding user rights and the like according to the roles of the users; the node management interface can be used for inquiring information such as version information, patch information, modification information and the like of the database, setting corresponding updating nodes, and updating or recovering the version of the database according to the version verification result of the database.
Namely, the step S100 specifically includes the following steps:
step S110, obtaining user information input by the user;
step S120, verifying the user information and determining the user authority of the user;
step S130, the interface options selected by the user are obtained, and the corresponding management interface is entered according to the interface options and the user permission.
In the embodiment, the user permission of each user is set, and when the user logs in the management tool, the input user information is verified, so that the user permission of the user is determined according to the input user information, and the user is given corresponding functions and operation permissions according to the determined user permission.
As shown in fig. 1, in one implementation manner of the present embodiment, the database management method further includes the following steps:
and step 200, recording the updating operation of the user in the management interface and the updating information of the user to the database.
In this embodiment, after entering a corresponding management interface, each user may record operation information executed by the user through the management tool, and record update information set by each user when updating data information in the database, so as to determine whether the current version of the database can be updated according to the recorded update operation and the update information, that is, verify the current version of the database according to the update information and the update operation; meanwhile, the updating operation and the updating information are recorded, so that subsequent maintenance personnel can conveniently inquire the corresponding abnormal conditions from the recorded information.
Specifically, when the update operation and the update information are recorded, the user entering the management interface is screened according to preset conditions, wherein the preset conditions are that the set job requirements are met, for example: the set job position requirement is a manager; then, selecting users meeting the job requirements, and recording the updating operation of the users; if the user clicks the database editing button, when the user finishes editing, recording the operation executed by the user, the update information generated in the editing process and the modified content recorded in the editing process; generating an update log according to the update operation, the update information, the update time and the modified content (original information before update) executed by the user; for example, the generated update log is: modification version information, version information 1.13, original version information 1.12, modification time XX, and executor Y.
Further, when the update operation and the update information are recorded, the database can be synchronized according to the update information, and a database version number based on the update information is generated after each synchronization, wherein the database version number can contain a plurality of modifications or patches, but in some special cases, additional tags are required to be set; for example: and managing some changes in the database, classifying versions in the database and other updating operations, and setting additional tags so as to query or acquire corresponding updating operations according to the additional tags.
Namely, the step S200 specifically includes the following steps:
step S210, screening users entering the management interface according to preset conditions;
step S220, recording the update operation, update information, updated content and update time executed by the selected user;
step 230, generating an update log according to the update operation, the update information, the updated content and the update time.
According to the embodiment, the update operation and the update information of the user in the management interface are recorded, and the current version of the database can be checked according to the recorded information, so that when the update of the version of the database fails, the version of the database can be restored according to the recorded update operation and the recorded update information; and by recording the operation information and the update information executed by each user, the subsequent maintenance personnel can conveniently inquire the corresponding abnormal conditions from the recorded information.
As shown in fig. 1, in one implementation manner of the present embodiment, the database management method further includes the following steps:
and step S300, checking the current version of the database according to the updating operation and the updating information.
In this embodiment, after the update operation and the update information are recorded, if it is detected that the user upgrades the current version of the database, the current version of the database is checked according to the update operation and the update information, so as to determine whether the current version of the database can be upgraded.
Specifically, when checking the current version of the database, the definition object of the database can be checked according to the content in the update log, and when the update log contains the definition object of the database, the definition object of the database in the current version is different from the definition object of the previous version; in short, when checking, judging whether the definition object of the database in the current version is updated, if the definition object of the database in the current version is not updated, judging that the current version of the database is not abnormal, and at the moment, updating the current version of the database; if the definition object of the database in the current version is updated, determining that the current version of the database is abnormal, and at the moment, indicating that the current version of the database is not suitable for updating.
Namely, the step S300 specifically includes the following steps:
step S310, checking the current version of the database according to the update log, and judging whether the definition object of the database in the current version is updated or not;
step S320, if the definition object of the database in the current version is not updated, judging that the current version of the database is not abnormal;
step S330, if the definition object of the database in the current version is updated, determining that the current version of the database is abnormal.
In the embodiment, the current version of the database is checked to judge whether the definition object in the current version of the database is lost, and if the verification is successful, the current version of the database is upgraded, so that the running stability of the upgraded database is ensured; if the verification fails, the lost definition object can be recovered according to specific conditions, so that errors are rapidly removed, and the continuous and stable operation of the database is ensured.
As shown in fig. 1, in one implementation manner of the present embodiment, the database management method further includes the following steps:
and step S400, updating the current version of the database according to the verification result, or recovering the current version of the database to the previous version.
In this embodiment, after checking the current version of the database, the current version of the database may be updated according to the checking result, so that a user who subsequently develops may stably run the updated new version; or recovering the current version of the database to the previous version according to the verification result, so as to recover the lost definition object according to specific conditions, thereby rapidly eliminating errors and ensuring continuous and stable operation of the database.
Specifically, when the current version of the database is updated, searching a position corresponding to the updated content according to the update log, and setting a corresponding update node at the searched position; and then, writing the update information in the update log into the update node to update the current version of the database.
Namely, in the step S400, the current version of the database is updated according to the verification result, which specifically includes the following steps:
step S411, searching the position corresponding to the updated content according to the update log;
step S412, setting corresponding update nodes at the searched positions;
step S413, writing the update information in the update log into the update node to update the current version of the database.
Specifically, when the current version of the database is recovered, the definition object of the database can be searched according to the updated content in the update log, and then the lost definition object is recovered according to specific conditions, so that errors are rapidly eliminated and continuous and stable operation of the database is ensured.
Namely, in the step S400, the method for restoring the current version of the database to the previous version specifically includes the following steps:
step S421, searching the original definition object of the database according to the updated content;
step S422, recovering the current version of the database to the previous version according to the original defined object.
In actual application, different updating operations are executed for different management interfaces, and the user management interface, the role management interface and the node management interface are described below.
As shown in fig. 2, the following steps are included in the user management interface:
step S11, entering a user management page;
step S12, screening user information according to conditions;
step S13, displaying users meeting the conditions;
step S14, clicking an editing button by a user;
step S15, judging whether the user has editing authority; if yes, go to step S16; if not, executing step S17;
s16, entering an editing page;
step S17, prompting that no editing authority exists, and returning to step S13;
and S18, completing editing and storing in a database.
When entering the user management page, if the user needs to add the user information, entering the new page according to the new button clicked by the user, and storing the new user information into the database after the user inputs the user information.
As shown in fig. 3, the role management interface includes the following steps:
step S21, entering a role management interface;
step S22, displaying the existing role information;
step S23, selecting a user;
step S24, clicking an editing button by a user;
step S25, entering an editing interface;
step S26, editing is completed and the database is stored.
When entering the character management interface, if the user needs to add the character information, entering a new page according to the new button clicked by the user, and storing the new character information into a database after the character information is input by the user.
As shown in fig. 4, the node management interface includes the following steps:
step S31, selecting branches to which database versions belong;
step S32, newly adding a modification node;
step S33, selecting modification information, and modifying the modification information;
step S34, newly adding a patch;
step S35, selecting patch information;
step S36, newly adding the version information of the database.
The patch is a program for repairing system loopholes in a database version, belongs to a child node under the database version and is used for repairing problems and small changes in the database version;
modifying the modification information refers to one change of the database version, and is the atomic data of the database version management tool; after associating with a version under a branch, the current version of the database is in an associated state.
The embodiment can realize the modification of the storage process executed by the software development by multiple persons or the modification of the function codes in the software, and control the version of the database for the software development, namely, the application program and the database are placed under the same version, so that the problems of the released program can be traced in the process of the software development, thereby being convenient for the tracing personnel of the software development to carry out related modification on the database; and by checking the version of the software development, the version of the database generated in the software development process is checked, so that the database is updated according to the checking result, or the database is restored to a stable state.
Example two
As shown in fig. 5, the present embodiment provides a terminal, which includes aprocessor 10, and amemory 20 connected to theprocessor 10, where thememory 20 stores a database management program, and the database management program is used to implement the operations of the database management method according to the first embodiment when executed by theprocessor 10; as described in detail above.
Example III
The present embodiment provides a storage medium storing a database management program for implementing the operations of the database management method according to the first embodiment when the database management program is executed by a processor; as described in detail above.
In summary, when the user updates the database, the update operation executed by the user and the corresponding update information are recorded, so that the version of the database is checked according to the recorded information, and the version of the database is updated or restored by the developer conveniently by managing the data change in the database.
Of course, those skilled in the art will appreciate that implementing all or part of the above-described methods may be implemented by a computer program for instructing relevant hardware (such as a processor, a controller, etc.), where the program may be stored in a computer-readable storage medium, and where the program may include the steps of the above-described method embodiments when executed. The storage medium may be a memory, a magnetic disk, an optical disk, or the like.
It is to be understood that the invention is not limited in its application to the examples described above, but is capable of modification and variation in light of the above teachings by those skilled in the art, and that all such modifications and variations are intended to be included within the scope of the appended claims.