Database design is the foundation of the digital economy and an important soft infrastructure.
openDB is a set of open data table design specifications, including schema definitions such as table names, fields, and initial data.
Taking the user table as an example, it stipulates the table name and field definition of a standard user table, and based on the characteristics of
nosql, the fields can be extended by developers themselves.
openDB is an important soft infrastructure of uniCloud, supporting the development of the uniCloud digital ecosystem.
php/java; however, most front-end engineers are not familiar with database design. When using
uniCloud to develop projects, many front-end engineers hope to have mature database templates. avoid detours
openDB already supports dozens of tables. It can be viewed at https://gitee.com/dcloud/opendb/tree/master/collection.
Some commonly used tables are classified as follows:
openDB not only supports the definition of commonly used data table fields, but also can preset initialization data.
For example, opendb-city-china is the
Chinese city dictionary table defined in opendb, its definition Divided into two parts:
When you create an
openDB table through the uniCloud web console,
uniCloud will automatically check whether the opendb table definition contains
data.json is automatically imported after the table definition is created.
If in your HBuilderX project, the data table defined in the
uniCloud/database directory contains an opendb table definition, when the
Upload DB Schema operation is performed on the opendb table, the uniCloud server will determine whether the opendb table already exists:
data.json. If it contains
data.json, it will automatically import
openDB data table may involve changes to
preset data in subsequent update iterations. Since
HBuilderX 3.5.1, opendb tables support checking for updates.
Take opendb-city-china as an example, when we want to modify or supplement the city, in order to be compatible with the deployed The data table should provide differential data, then what we need to do is:
version field in
opendb-city-china/package.json to the upgraded version number;
opendb-city-china/collection.update-original version number-upgrade version number.jql JQL database manager file, the content is JQL statement of differential data;
For example, the revocation or establishment of an administrative area requires data upgrade, and the upgraded version number is defined as 0.0.2, then the difference data needs to be written into the file
opendb-city-china/collection.update-0.0 in the form of JQL statements .1-0.0.2.jql, and update the
version field of
In the uniCloud web console, when creating a new table, you can directly select all
First select the category, there are several tables under each category, and the table structure and preset data can be previewed directly. Multiple tables are supported to be created together.
The table name of
openDB should not be modified. After modification, it cannot be combined with other plugins.
openDB is an evolving specification built by developers. DCloud welcomes professional developers in various business fields to provide specifications.
Developers can add specifications to
openDB, or add fields to tables with existing specifications, or add initialization data by submitting PRs. gitee supports lightweight pr, which is especially suitable for co-editing specifications.
openDB only adds tables and fields, but does not delete or modify them.