数据库结构
此章节将讲解 QuickShop-Hikari 的数据库存储格式的实现细节。
数据表
This section explains the database tables created by QuickShop-Hikari.
Unless otherwise specified, the initial qs_
in table name is the table prefix.
For the latest code definition for each table, see: DataTables.java
数据
此数据表存储此服务器上的所有现有存储数据或已删除但仍以特定形式引用的存储数据,并且不包含坐标信息。
无论如何,数据记录在创建后都不应被修改,直到它被删除。
对商店的任何新更改都应创建一个新副本,将更改应用于该副本,并将其作为新记录插入。
基本上是书写的。
仅当没有任何表引用其数据记录时,才会从数据库中删除数据记录 data_id
.
项目名称 | 数据类型 | 默认值 | 说明 |
---|---|---|---|
id | INT UNSIGNED Primary Key | Auto Increment | 记录 ID(又叫 data_id ) |
owner | VARCHAR(36) NOT NULL | N/A | 店主个人ID(又叫UUID) |
item | TEXT NOT NULL | N/A | YAML serialized ItemStack for this shop data entry |
type | INT NOT NULL | 0 | The shoptype id, Indicates the store type |
currency | VARCHAR(64) | NULL | The currency name for this shop data entry. NULL if using Vault or not supported |
price | DECIMAL(32,2) NOT NULL | N/A | The price per stack for this shop data entry |
unlimited | BIT NOT NULL | 0 | Indicates whether this store is an unlimited store, 0=Limited, 1=Unlimited |
hologram | BIT NOT NULL | 0 | Indicates the suspension status of this store's display item, 0=Follow global settings, 1=Disabled |
tax_account | VARCHAR(36) | NULL | The uuid for tax account, If it is not NULL, tax will be paid to the specified account |
permissions | MEDIUMTEXT | Empty Json | Indicates the override status of the store player permission group, serilized to JSON string |
extra | LONGTEXT | Empty Yaml | Used to store experimental settings of QuickShop Hikari or persistent data of other plugins |
inv_wrapper | VARCHAR(255) NOT NULL | N/A | Unique identifier for InventoryWrapper for this shop data entry |
inv_symbol_link | TEXT NOT NULL | N/A | Unique Inventory symbol used to pass to InventoryWrapper, for locating inventory |
create_time | DATETIME NOT NULL | Dataset Insert Time | Indicates when this store was created |
benefit | MEDIUMTEXT | N/A | Setup of Benefit Allocation after JSON Serialization |
shops
This table is used to store shop to shop data mapping, so that shop ID will not change when shop data changes.
Multiple shop_id
can correspond to the same data_id
.
项目名称 | 数据类型 | 默认值 | 说明 |
---|---|---|---|
id | INT UNSIGNED Primary Key | Auto Increment | Record ID (aka. shop_id ) |
data_id | INT UNSIGNED NOT NULL | N/A | Data Record ID (aka. data_id ) |
shop_map
This table is used to store shop_id to shop location in Bukkit mapping. At the same time, this is also the key record of loading the store into the game world.
项目名称 | 数据类型 | 默认值 | 说明 |
---|---|---|---|
world | VARCHAR(32) NOT NULL | N/A | The world name in Bukkit |
x | INT NOT NULL | N/A | The block X position for this shop |
y | INT NOT NULL | N/A | The block Y position for this shop |
z | INT NOT NULL | N/A | The block Z position for this shop |
messages
This table is used to store offline messages.
项目名称 | 数据类型 | 默认值 | 说明 |
---|---|---|---|
id | INT UNSIGNED Primary Key | Auto Increment | Record ID |
receiver | VARCHAR(36) NOT NULL | N/A | The unique id for receiver |
time | DATETIME | Dataset Insert Time | The time that this message created |
content | MEDIUMTEXT NOT NULL | N/A | Serialized Adventure Component |
metadata
This table is used to store the metadata, e.g database schema version.
项目名称 | 数据类型 | 默认值 | 说明 |
---|---|---|---|
key | VARCHAR(255) NOT NULL Primary Key | N/A | The key |
value | LONGTEXT NOT NULL | N/A | The value |
player
This table is used to store the player data, e.g locales.
项目名称 | 数据类型 | 默认值 | 说明 |
---|---|---|---|
uuid | VARCHAR(36) NOT NULL Primary Key | N/A | The player unique id |
locale | VARCHAR(255) NOT NULL | N/A | The player's client locale |
cachedName | VARCHAR(255) NOT NULL | N/A | The player's username last known |
external_cache
This table is stored cached shop space/stock for WebUI or what else other pure database apps.
项目名称 | 数据类型 | 默认值 | 说明 |
---|---|---|---|
shop | INT UNSIGNED NOT NULL Primary Key | N/A | The id of shop (aka. shop_id ) |
stock | INT NOT NULL | N/A | The stock for this shop |
space | INT NOT NULL | N/A | The space for this shop |
log_purchase
This table records all history purchases activities on this server.
项目名称 | 数据类型 | 默认值 | 说明 |
---|---|---|---|
id | INT UNSIGNED Primary Key | Auto Increment | Record ID |
time | DATETIME NOT NULL | Dataset Insert Time | The time that this purchase created |
shop | INT UNSIGNED NOT NULL | N/A | The shop id (aka. shop_id ) |
数据 | INT UNSIGNED NOT NULL | N/A | The data id (aka. data_id ) |
buyer | VARCHAR(36) NOT NULL | N/A | The purchaser unique id, In fact, it is more accurate to call it a purchaser, not only selling but also buying |
type | VARCHAR(32) NOT NULL | N/A | The ShopType enum name |
amount | INT NOT NULL | N/A | Purchased stack amount |
money | DECIMAL(32,2) NOT NULL | N/A | Total balance in this purchase |
tax_amount | DECIMAL(32,2) NOT NULL | 0 | The tax in this purchase |
log_transaction
TODO
log_changes
TODO
log_others
TODO