Database design method, apparatus and related device
By automatically generating database change scripts, the problem of low efficiency in full-process scripts after database modifications in existing technologies is solved, achieving efficient database management and improved user experience, and supporting cloud service mode.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-15
- Publication Date
- 2026-04-07
AI Technical Summary
Existing database design systems automatically generate full scripts after database modifications, leading to inefficiency during development and iteration, and manual writing of change scripts is prone to errors.
A database design system is provided that can automatically generate database change scripts, including upgrade scripts and rollback scripts. By comparing the original database version with the modified design view, the system automatically creates scripts using SQL syntax and a template generator.
It improves the efficiency of database management, reduces the amount of data processing, enhances user experience and work efficiency, supports cloud service models, and increases flexibility.
Smart Images

Figure CN113806325B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of database technology, and in particular to a database design method, apparatus and related equipment. Background Technology
[0002] During project development or iteration, it is often necessary to modify the database according to requirements, such as adding or deleting data, thus creating a new database version. After users modify the database design view using an existing database design system, the system generates a full script of the modified database. This full script includes all data information of the modified database. Developing and iterating the database solely based on this full script during subsequent development or iteration will cause numerous inconveniences for users. Summary of the Invention
[0003] This application discloses a database design method, apparatus, and related equipment, which can automatically generate database change scripts after the database design is modified, making it convenient for users to develop and manage the database.
[0004] In a first aspect, embodiments of this application provide a database design method, which is applied to a database design system and includes:
[0005] The database design system provides users with a first interface, which includes the design view of the original database version;
[0006] Receive modifications made by the user to the design view through the first interface;
[0007] Based on the modifications, a database change script is generated, which is used to control the conversion between the original database version and the modified database version.
[0008] The database change scripts generated by the above methods enrich the types of scripts that the database design system can generate, making it easier for users to manage the database and improving work efficiency.
[0009] In one specific implementation, the database change script includes an upgrade script and a rollback script. The upgrade script is used to run to convert the original database version into the modified database version; the rollback script is used to run to convert the modified database version back into the original database version.
[0010] Database design systems can automatically generate change scripts such as upgrade scripts and rollback scripts, which can reduce the amount of data that the database design system needs to process when converting between the original database version and the modified database version, thereby improving work efficiency.
[0011] In one specific implementation, the database design system runs in a cloud data center, and the user is a user who purchases database cloud services in the cloud data center.
[0012] Providing database design cloud services to users through cloud services increases the flexibility of database design and usage, and can improve the user experience.
[0013] In one specific implementation, the above method further includes: the database design system providing a second interface to the user, the second interface including the above-mentioned change script; the database design system receiving the user's modifications to the change script through the second interface, and obtaining the modified change script.
[0014] The database design system allows users to edit and modify the change scripts automatically generated by the system. Users can directly modify the change scripts as needed, which can improve user efficiency and enhance user experience.
[0015] In one specific implementation, before generating the database change script based on the modification, the method further includes: the database design system providing a third interface to the user, the third interface including a database type option; the database design system receiving the target database type input by the user through the database type option; and generating the database change script based on the modification, including: the database design system generating a database change script corresponding to the target database type based on the modification.
[0016] Database design systems can automatically generate change scripts for user-specified databases based on project requirements, thereby improving user efficiency and enhancing user experience.
[0017] In one specific implementation, the above method further includes: the database design system providing a fourth interface to the user, the fourth interface including configuration information, which includes any one or more of the following: script name, script save path, script save method, or script mode; the database design system receiving the user's settings for the configuration information through the fourth interface; and generating a database change script based on the above modifications, including: the database design system generating and saving the database change script based on the configuration information.
[0018] The database design system allows users to customize script names, script save paths, and script save methods. Users can freely configure the above information according to project needs and other requirements, which can improve the user experience.
[0019] In one specific implementation, a database change script is generated based on the modifications, including: the database design system obtaining the design view of the original database version and the design view of the modified database version; and generating the database change script based on the differences between the design view of the original database version and the design view of the modified database version.
[0020] Secondly, embodiments of this application provide a database design apparatus, which is applied to a database design system. The apparatus includes:
[0021] The display module is used to provide the user with a first interface, which includes the design view of the original database version.
[0022] A receiving module is used to receive modifications made by the user to the design view through the first interface;
[0023] The processing module is used to generate a database change script based on the modification, and the database change script is used to control the conversion between the original database version and the modified database version.
[0024] In one specific implementation, the database change script includes an upgrade script and a rollback script. The upgrade script is used to run in order to convert the original database version into the modified database version; the rollback script is used to run in order to convert the modified database version back into the original database version.
[0025] In one specific implementation, the database design system runs in a cloud data center, and the user is a user who purchases database cloud services from the cloud data center.
[0026] In one specific implementation, the display module is further configured to provide a second interface to the user, the second interface including the change script;
[0027] The receiving module is also used to receive the user's modifications to the change script through the second interface, and obtain the modified change script.
[0028] In one specific implementation, the display module is further configured to provide a third interface to the user, the third interface including a database type option; the receiving module is further configured to receive the target database type input by the user through the database type option; and the processing module is specifically configured to: generate a database change script corresponding to the target database type based on the modification.
[0029] In one specific implementation, the display module is further configured to provide a fourth interface to the user, the fourth interface including configuration information, the configuration information including any one or more of the following: script name, script save path, script save method or script mode;
[0030] The receiving module is also used to receive the configuration information settings made by the user through the fourth interface;
[0031] The processing module is specifically used to generate and save the database change script based on the configuration information.
[0032] In one specific implementation, the processing module is specifically used to: obtain the design view of the original database version and the design view of the modified database version; and generate the database change script based on the difference information between the design view of the original database version and the design view of the modified database version.
[0033] Thirdly, embodiments of this application provide a computing device, which includes a processor and a memory; the memory stores a computer program; when the processor executes the computer program, the computing device executes the method in the first aspect or any specific implementation thereof.
[0034] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a network device, perform the methods described in the first aspect or any specific implementation thereof.
[0035] Fifthly, this application provides a computer program product including computer instructions. When executed by a computing device, the computing device performs the method described in the first aspect or any specific implementation thereof. The computer program product can be a software installation package. When the method described in the first aspect or any specific implementation thereof is required, the computer program product can be downloaded and executed on the computing device. Attached Figure Description
[0036] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1a This is a deployment diagram of a local design tool provided in an embodiment of this application;
[0038] Figure 1b This is a deployment diagram of a cloud-based design tool provided in an embodiment of this application;
[0039] Figure 2 This is a flowchart illustrating a database design method provided in an embodiment of this application;
[0040] Figure 3 This is a schematic diagram of a database design view provided in an embodiment of this application;
[0041] Figure 4 This is a schematic diagram of a difference details interface provided in an embodiment of this application;
[0042] Figure 5 This is a schematic diagram of a third interface provided in an embodiment of this application;
[0043] Figure 6 This is a schematic diagram of a fourth interface provided in an embodiment of this application;
[0044] Figure 7 This is a schematic diagram of a database design apparatus provided in an embodiment of this application;
[0045] Figure 8 This is a schematic diagram of the structure of a computing device provided in an embodiment of this application. Detailed Implementation
[0046] The technical solutions in this application will now be described with reference to the accompanying drawings.
[0047] A database (DB) is a repository for organizing, storing, and managing data according to a data structure. It is an organized, shareable collection of large amounts of data stored in a computer.
[0048] Structured Query Language (SQL) is a database product and programming language used to access, query, update, and manage relational databases.
[0049] A table is a structured file used to store specific types of data, such as employee information or product catalogs. Data in a database is typically stored in the form of tables, each with a unique identifier, such as a table name. A table consists of one or more columns, each a field within the table, storing information about a specific part of the data. For example, in a table named "employee," one column might store the employee's ID, and another might store the city where the employee resides.
[0050] A script is an executable file written in a specific descriptive language according to a certain format. A database script is a collection of statements used to create, modify, and query data in a database. A full script contains information about all the data in the database. Executing a full script on a server can create a new database on the server.
[0051] A database design system is a visual tool for designing and managing databases. It's used to create, use, and maintain databases. Users can create database design views within the system, including diagrams and relationships between them. The system can then generate a full database script based on these design views. The server generates the database by running this full script. When users need to modify data in the database, they can do so by modifying the design view within the system. After the user completes the modifications, the system generates a new full script based on the revised design view.
[0052] During project development, it's often necessary to design or modify databases based on user and software requirements. For example, adding or deleting a column in a table of an existing database might be required to create a new database version. Currently, when modifying the database, users need to use the visual interface of a database design system to modify the design view of the original database version, obtaining the modified design view. The database design system can automatically generate a full script corresponding to the modified database based on the modified design view. When this full script is run on the server, it creates a new database version. Except for the data modified by the user, all other data in the new database version is identical to that in the original version. If the full script successfully tests in the test environment, it can be uploaded to the server, allowing the server to execute the script and generate new tables, creating a new database version that can then be used.
[0053] Current database design systems, based on visual database designs, typically generate full-scale scripts automatically. However, if change scripts (such as upgrade and rollback scripts) are needed during database changes, these must be written manually. When upgrading the database based on the upgrade script or restoring it to a previous version, these scripts must also be written manually. Manually writing these scripts is inefficient and prone to errors.
[0054] To address the aforementioned problems, embodiments of this application provide a database design system and a database design method. By executing the database design method provided in this application's database design system, change scripts can be automatically generated. This method, after a user modifies the design view of the original database version, determines the modified content in the database by comparing the original and modified design views, and then automatically generates various types of scripts, such as upgrade scripts, rollback scripts, and full scripts, based on SQL syntax and a template-based code generator.
[0055] The database design system in this application is an application that provides a database development environment. The database design system includes at least one component, which refers to a simple encapsulation of data and methods. In some programming language systems, components can also be called parts, controls, etc. Based on the function of the components, the components included in the database design system can be divided into two types: front-end components and back-end components.
[0056] Front-end components refer to components that enable user interaction, such as a client, specifically used to receive user input data, display user-requested interfaces and data, etc. Back-end components refer to components that process data, specifically used to process received data according to predefined logic, or to retrieve data from a database for processing, etc. In this embodiment, the database design system may include at least one of the following tools: a graphical user interface, an integrated code editor, a compiler, and a debugger. The front-end components of the database design system may include components related to the graphical user interface, and the back-end components may include components related to compilers, debuggers, etc.
[0057] Based on different deployment methods, database design systems can be divided into local design tools and cloud-based design tools. Local design tools have both front-end and back-end components deployed locally. "Local" is also referred to as a local device. Local devices include user devices directly controlled by the user (such as laptops or other user terminals), or devices geographically close to the aforementioned user devices (such as local computer clusters). Cloud-based design tools, on the other hand, have at least some components (such as back-end components) deployed in the cloud. In this embodiment, the cloud refers to the end corresponding to the local location, i.e., the resource end that the local user remotely accesses via the network.
[0058] like Figure 1a As shown, Figure 1a This is a deployment diagram of a local design tool provided in an embodiment of this application. The aforementioned front-end components can run on various terminal devices, such as mobile phones, laptops, tablets, or personal desktop computers. The aforementioned back-end components can run on a computer cluster (including at least one computing device).
[0059] like Figure 1b As shown, Figure 1b This is a deployment diagram of a cloud-based design tool provided in an embodiment of this application. The database design system is deployed in a cloud platform. The cloud platform contains a large number of basic resources provided by a cloud service provider. For example, cloud platform 1 contains computing resources, storage resources, and network resources, and the computing resources can be a large number of computing devices (e.g., servers). The database design system can utilize the basic resources deployed in the cloud platform to implement the database design method provided in this embodiment of the application. For example, in response to a user-triggered database design system instance creation operation, the cloud platform creates a database design system instance on the resources provided by the cloud service provider.
[0060] It should be understood that a database design system can be a hardware system or a software system deployed on hardware devices and / or virtual machines. A database design system can also be implemented through a combination of hardware and software. When the database design system is a hardware system, it can be a collection of computing devices. When the database design system is a software system, it can be deployed independently on servers or virtual machines in a cloud platform, or it can be distributed across multiple servers in a cloud platform, or multiple virtual machines in a cloud platform, or a combination of servers and virtual machines in a cloud platform.
[0061] like Figure 1b As shown, a database design system can be abstracted into a database design cloud service by a cloud service provider and offered to users on a cloud platform. After a user purchases the database design cloud service on the cloud platform, the cloud platform can provide the database design cloud service to the user using the database design system deployed on the cloud platform. For example, the cloud platform can provide a graphical user interface (GUI) to users who have purchased the cloud service, displaying the GUI on the user's device, where the user can perform database design. The methods for purchasing the database design cloud service can include: pre-payment followed by settlement based on the actual usage of resources, or settlement based on the time spent using the cloud service or based on the purchased cloud service functions or resources.
[0062] It should be noted that, in the embodiments of this application, the cloud platform can be a central cloud platform, an edge cloud platform, or a cloud platform including both a central cloud and an edge cloud platform; this embodiment of the application does not specifically limit it. Furthermore, when the cloud platform includes both a central cloud and an edge cloud platform, the database design system can be partially deployed in the edge cloud platform and partially deployed in the central cloud platform.
[0063] like Figure 2 As shown, Figure 2 This is a flowchart illustrating a database design method provided in an embodiment of this application, such as... Figure 2 As shown, the database design method includes steps S201 to S203.
[0064] S201, Provide the user with the first interface.
[0065] In this embodiment, when a user (e.g., a developer) needs to modify the database, they can access the first interface provided by the database design system. This first interface includes a design view of the original database version (i.e., the database before modification). The user can modify the database design view through the first interface to achieve the purpose of modifying the database. The design view includes a diagram of at least one entity and the relationships between different entities. Each entity's diagram corresponds to a table in the database. Each entity's diagram includes information such as the entity's name, code, and attributes. The relationships between different entities include the name, code, and cardinalities of the relationship. Cardinalities include one-to-one, one-to-many, one-to-many, and many-to-many relationships. Entity attributes include the attribute's name and code. The attribute code corresponds to a field name in the database, and the attribute name is a Chinese description of the corresponding attribute code. For example, as shown... Figure 3 As shown, Figure 3 This is a schematic diagram of a database design view. Figure 3 The diagram illustrates a graph of three entities: students, courses, and classes, and the relationships between these entities. It is understood that the database design view can also include graphs of more entities and more relationships between them, which will not be described in detail in this embodiment.
[0066] S202, Receive user modifications to the design view of the original database version through the first interface.
[0067] After the user brings up the first interface mentioned above, they can modify the original database version's design view (original design view) according to their needs to obtain a new, modified design view. The database design system can then obtain the modified database version based on the modified design view. For example, if a user needs to create a new table based on the original database version, they will create a diagram of the new entity in the original design view corresponding to the original database version, configure the new entity's name, code, and attributes, and draw the relationships between the new entity and one or more entities in the original design view in the new design view. Or, if a user needs to insert a new field or delete an existing field in table 'a' of the original database version, they will need to add or delete the attribute codes in the diagram of the entity corresponding to table 'a'.
[0068] In this embodiment of the application, after modifying the design view of the original database version, the user can view the differences between the original database version and the modified database version in the difference details interface provided by the database design system.
[0069] For example, such as Figure 4 As shown, Figure 4 This is a schematic diagram of a difference details interface provided in an embodiment of this application. After a user modifies the original design view, the difference details interface of the database design system will display the user's modifications to the design view. Figure 4 As shown in the diagram, the difference details interface displays that the user inserted a column named "name" into the table named "employee" in the original database version. Simultaneously, the user changed the table name from "employee_777" to "employee_new".
[0070] S203. Based on the modifications, generate a database change script.
[0071] The database change script is used to control the conversion between the original database version and the modified database version. After a user modifies the original design view, the database design system can obtain the difference information between the new design view and the original design view. This difference information includes any one or more of the following: the name of the added table, the name of the deleted table, the name of the modified table, the name of the target field inserted or deleted in the modified table, the data type of the target field, the position of the target field in the target table, or the comment information of the target field. Based on the difference information, SQL syntax, and a template-based code generator, the database design system can generate a full database script and a database change script. The database change script includes any one or more of the following: upgrade script and rollback script.
[0072] The upgrade script includes information on data modified, added, or deleted in the original design view. When the upgrade script is executed on the server deploying the original database version, it can modify, add, or delete data in the database, converting the original database version to the modified version. The rollback script is used to convert the modified database version back to the original database version. When a user needs to convert the modified database version back to the original version, the server can execute the rollback script to restore the data in the database to its state before the modification.
[0073] Because the database design system in this embodiment uses incremental storage for the data structure corresponding to the database design view, after the user modifies the design view of the original database version, the background incrementally stores the modified data structure content based on the data structure of the original database version. Therefore, the database design system can generate an upgrade script relative to the original database version based on the incrementally stored modified data structure, and the database design system can also generate a rollback script relative to the modified database version based on the incrementally stored modified data structure.
[0074] For example, as described above Figure 4 Taking the user's modification of the original database version as an example, when the user executes the above... Figure 4 After the modifications are made, the database design system automatically generates upgrade and rollback scripts based on the differences between the original and new design views. Below is an example of a script automatically generated by the database design system.
[0075]
[0076] The script instructs that if a column named "NAME" does not exist in the table "EMPLOYEE", a column named "NAME" with data type "VARCHAR(32)" should be inserted into the table "EMPLOYEE". The column named "NAME" should be placed after and adjacent to the column named "PRIVILEGE_ID". Simultaneously, if a table named "EMPLOYEES777" exists in the database, it should be renamed to "EMPLOYEES_NEW".
[0077] In one specific implementation, after generating the full script, upgrade script, and rollback script, the database design system can provide a second interface to the user. This second interface includes the full script, upgrade script, and rollback script. The user can edit the automatically generated script through the second interface, such as commenting on SQL statements. The SQL statements that are different between the edited script and the original script can be highlighted. For example, the display color of the instructions modified by the user is different from that of the original script.
[0078] In one specific implementation, before generating the full script and modification script based on the aforementioned differences, the database design system can provide a third interface to the user. This third interface includes database type options, allowing the user to select and generate scripts corresponding to different database types. For example... Figure 5 As shown, Figure 5 This is a schematic diagram of a third interface provided in an embodiment of this application. Users can select the type of database script to be generated by triggering the database type option. It is understood that users can choose to generate a script for one database type, or they can choose to generate scripts for multiple database types simultaneously. For example, users can choose to generate a script for a MySQL database, or they can choose to generate a script for an Oracle database, or they can choose to generate scripts for both of the above database types. This embodiment of the application does not specifically limit this.
[0079] In one specific implementation, before generating the full script and modification script based on the aforementioned difference information, the database design system provides a fourth interface to the user. This fourth interface includes configuration information, such as script name, script save path, script save method, or script mode. Users can configure script information such as script name, script save path, script save method, and script mode through this fourth interface. The script save method refers to whether the newly generated script is saved using an append method or an overwrite method. An append method means the newly generated script does not replace the original script, while an overwrite method means the newly generated script replaces the original script. For example, if a rollback script for the original database version already exists before generating a new rollback script, if the append method is selected, both the original rollback script and the newly generated rollback script will be retained when generating the new rollback script. If the overwrite method is selected, the original rollback script will be deleted after generating the new rollback script, and the new rollback script will be saved. Script modes include normal mode and special mode. In special mode, the result of executing a script multiple times is the same as the result of executing it once. In normal mode, when a script is executed multiple times, the database generated each time may be inconsistent.
[0080] like Figure 6 As shown, Figure 6 This is a schematic diagram of a fourth interface provided in an embodiment of this application. Users can access it through... Figure 6 The interface shown displays configuration options and script information. Figure 6 Users can select the save path and upgrade method for the full script, upgrade script, and rollback script, and edit the script name for each script. The Secure SQL option is used to select whether to generate a script in normal mode or a script in special mode. When the user selects Secure SQL, it means that a script in special mode will be generated; when the user does not select Secure SQL, it means that a script in normal mode will be generated.
[0081] It should be noted that the aforementioned fourth interface may include, for example: Figure 6 The configuration options shown may include more or fewer options. For example, the configuration interface may only include some options such as script name, script save path, script save method, and script mode. Additionally, the database design system can provide default options for each of these configuration options. Users can choose to modify some or all of the configuration options on the fourth interface. When a user chooses to modify some configuration options on the configuration interface, the other configuration options will use their default settings. For example, a user can manually edit the script name and select the secure SQL mode, without modifying the script save path and script save method.
[0082] This application provides a database design apparatus that can be deployed in a cloud data center. For example... Figure 7 As shown, the database design apparatus 700 may include:
[0083] Display module 710 is used to provide a first interface to the user, which includes the design view of the original database version;
[0084] The receiving module 720 is used to receive modifications made by the user to the design view through the first interface mentioned above;
[0085] The processing module 730 is used to generate a database change script based on the above modifications. The database change script is used to control the conversion between the original database version and the modified database version.
[0086] Optionally, the database change scripts mentioned above include upgrade scripts and rollback scripts, wherein the upgrade script is used to run in order to convert the original database version into the modified database version; and the rollback script is used to run in order to convert the modified database version back into the original database version.
[0087] Optionally, the database design system runs in a cloud data center, and the user is a user who purchases database cloud services for the cloud data center.
[0088] Optionally, the display module 710 is further configured to provide a second interface to the user, the second interface including the change script; the receiving module 720 is further configured to receive the user's modification of the change script through the second interface, and obtain the modified change script.
[0089] Optionally, the display module 710 is also used to provide a third interface to the user, the third interface including a database type option; the receiving module 720 is also used to receive the target database type input by the user through the database type option; and the processing module 730 is specifically used to generate a database change script corresponding to the target database type according to the modification.
[0090] Optionally, the display module 710 is also used to provide a fourth interface to the user, the fourth interface including configuration information, which includes any one or more of the following: script name, script save path, script save method, or script mode; the receiving module 720 is also used to receive the user's settings for the configuration information through the fourth interface; the processing module 730 is specifically used to generate and save the database change script according to the configuration information.
[0091] Optionally, the processing module 730 is specifically used to: obtain the design view of the original database version and the design view of the modified database version; and generate the database change script based on the difference information between the design view of the original database version and the design view of the modified database version.
[0092] The aforementioned units can transmit data to each other through communication channels. It should be understood that the modules included in the device 700 can be software modules, hardware modules, or a combination of software and hardware modules.
[0093] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the delay guarantee system, delay guarantee device and each module described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0094] Since the modules in the database design system provided in this application embodiment can be distributed and deployed on multiple computers in the same or different environments, this application embodiment also provides a computing device. In some cases, the computing device can be a computer system, including one or more computers 800. For example, as... Figure 8As shown, each computer 800 includes a memory 801, a processor 802, a communication interface 803, and a bus 804. The memory 801, processor 802, and communication interface 803 are interconnected via the bus 804.
[0095] The memory 801 can be a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 801 can store programs. When the program stored in the memory 801 is executed by the processor 802, the processor 802 and the communication interface 803 are used to execute the database design method provided in this embodiment. The memory 801 may also include software modules and data required by other running processes, such as an operating system. The operating system can be LINUX. TM UNIX TM WINDOWS TM wait.
[0096] The processor 802 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), a graphics processing unit (GPU), or one or more integrated circuits.
[0097] The processor 802 can also be an integrated circuit chip with signal processing capabilities. In implementation, some or all functions of the database design system of this application can be completed through integrated logic circuits in the hardware of the processor 802 or instructions in software form. The aforementioned processor 802 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 801. Processor 802 reads the information in memory 801 and, in conjunction with its hardware, completes part of the functions of the database design system of this application embodiment.
[0098] The communication interface 803 uses transceiver modules, such as, but not limited to, transceivers, to enable communication between the computer 800 and other devices or communication networks.
[0099] Bus 804 may include a pathway for transmitting information between various components of computer 800 (e.g., memory 801, processor 802, communication interface 803).
[0100] Each of the aforementioned computers 800 establishes a communication path through a communication network. Each computer 800 is used for a portion of the functions of the database design system. Any computer 800 can be a computer in a cloud data center (e.g., a server) or a computer in an edge data center.
[0101] The descriptions of the processes corresponding to the above-mentioned figures each have their own emphasis. For parts of a process that are not described in detail, please refer to the relevant descriptions of other processes.
[0102] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, in whole or in part, as a computer program product. The computer program product providing database design cloud services includes one or more computer instructions, which, when loaded and executed on a computer, generate, in whole or in part, the database according to the embodiments of this application. Figure 2The process or function described.
[0103] The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium stores computer program instructions that provide database design cloud services.
[0104] This application also provides a computer-readable storage medium, which can be a non-transient readable storage medium. When the instructions in the computer-readable storage medium are executed by a computer, the computer executes the database design method provided in this application. The computer-readable storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD).
[0105] This application also provides a computer program product including computer instructions, which, when executed by a computing device, enable the computing device to perform the database design method provided in the embodiments of this application.
[0106] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0107] In the embodiments of this application, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. The term "one or more" refers to one or more items, and the term "multiple" refers to two or more items, unless otherwise expressly defined.
[0108] In this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0109] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the concept and principles of this application should be included within the protection scope of this application.
Claims
1. A database design method, characterized in that, The method is applied to a database design system, including: A first interface is provided to the user, which includes a design view of the original database version; the design view includes a diagram of at least one entity and the relationships between different entities; Receive modifications made by the user to the design view through the first interface; Obtain the design views of the original database version and the modified database version. Based on the differences between the design views of the original database version and the modified database version, as well as the SQL syntax, generate a database change script. The database change script is used to control the conversion between the original database version and the modified database version. The database change script includes an upgrade script and a rollback script. The upgrade script is run to convert the original database version to the modified database version. The rollback script is run to convert the modified database version back to the original database version. The script mode of the change script is either normal mode or idempotent mode. When the script in normal mode is executed multiple times, the generated databases may be inconsistent. When the script in idempotent mode is executed multiple times, the result is the same as the result of executing it once.
2. The method according to claim 1, characterized in that, The database design system runs in a cloud data center, and the user is a user who purchases database cloud services in the cloud data center.
3. The method according to claim 1, characterized in that, The method further includes: A second interface is provided to the user, the second interface including the change script; The system receives the user's modification of the change script through the second interface and obtains the modified change script.
4. The method according to any one of claims 1 to 3, characterized in that, Before generating the database change script based on the modifications, the method further includes: A third interface is provided to the user, the third interface including database type options; Receive the target database type input by the user through the database type option; The step of generating a database change script based on the modifications includes: Based on the modifications, a database change script corresponding to the target database type is generated.
5. The method according to any one of claims 1 to 3, characterized in that, The method further includes: A fourth interface is provided to the user, the fourth interface including configuration information, the configuration information including any one or more of the script name, script save path, script save method or script mode; Receive the configuration information settings from the user through the fourth interface; Based on the modifications, a database change script is generated, including: Generate and save the database change script based on the configuration information.
6. A database design apparatus, characterized in that, The device is used in a database design system and includes: The display module is used to provide the user with a first interface, which includes the design view of the original database version. A receiving module is used to receive modifications made by the user to the design view through the first interface; A processing module is used to obtain the design view of the original database version and the design view of the modified database version. The design view includes a diagram of at least one entity and the relationships between different entities. Based on the differences between the design views of the original database version and the modified database version, as well as the SQL syntax, a database change script is generated. The database change script is used to control the conversion between the original database version and the modified database version. The database change script includes an upgrade script and a rollback script. The upgrade script is used to convert the original database version to the modified database version. The rollback script is used to convert the modified database version back to the original database version. The script mode of the change script is either normal mode or idempotent mode. When the script in normal mode is executed multiple times, the generated databases may be inconsistent. When the script in idempotent mode is executed multiple times, the result is the same as the result of executing it once.
7. The apparatus according to claim 6, characterized in that, The database design system runs in a cloud data center, and the user is the user who purchases database cloud services from the cloud data center.
8. The apparatus according to claim 6, characterized in that, The display module is also used to provide a second interface to the user, the second interface including the change script; The receiving module is also used to receive the user's modifications to the change script through the second interface, and obtain the modified change script.
9. The apparatus according to any one of claims 6 to 8, characterized in that, The display module is also used to provide a third interface to the user, the third interface including database type options; The receiving module is also configured to receive the target database type input by the user through the database type option; The processing module is specifically used for: Based on the modifications, a database change script corresponding to the target database type is generated.
10. The apparatus according to any one of claims 6 to 8, characterized in that, The display module is also used to provide a fourth interface to the user. The fourth interface includes configuration information, which includes any one or more of the following: script name, script save path, script save method, or script mode. The receiving module is also used to receive the configuration information settings made by the user through the fourth interface; The processing module is specifically used for: Generate and save the database change script based on the configuration information.
11. A computing device, characterized in that, It includes a processor and a memory, the memory being used to store instructions, the processor being used to execute the instructions, and when the processor executes the instructions, it performs the method as described in any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a network device, perform the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
A big data warehouse design method and system based on visualization
CN109684300A
Online database table management method and device and computer equipment
CN109726194A
Field information processing method and device, storage medium and processor
CN111125262A