跳转至主要内容

数据库结构

此章节将讲解 QuickShop-Hikari 的数据库存储格式的实现细节。

数据表

本节将对QuickShop-Hikari创建的数据库表进行说明。
除非另有说明,否则首字母 qs_ 在“表名”中是表前缀。
有关每个表的最新代码定义,请参阅: DataTables.java

数据

此数据表存储此服务器上的所有现有存储数据或已删除但仍以特定形式引用的存储数据,并且不包含坐标信息。
无论如何,数据记录在创建后都不应被修改,直到它被删除。
对商店的任何新更改都应创建一个新副本,将更改应用于该副本,并将其作为新记录插入。

基本上是书写的。

仅当没有任何表引用其数据记录时,才会从数据库中删除数据记录 data_id.

项目名称数据类型默认值说明
idINT UNSIGNED Primary KeyAuto Increment记录 ID(又叫 data_id)
ownerVARCHAR(36) NOT NULLN/A店主个人ID(又叫UUID)
itemTEXT NOT NULLN/AYAML serialized ItemStack for this shop data entry
typeINT NOT NULL0The shoptype id, Indicates the store type
currencyVARCHAR(64)NULLThe currency name for this shop data entry. NULL if using Vault or not supported
priceDECIMAL(32,2) NOT NULLN/AThe price per stack for this shop data entry
unlimitedBIT NOT NULL0Indicates whether this store is an unlimited store, 0=Limited, 1=Unlimited
hologramBIT NOT NULL0Indicates the suspension status of this store's display item, 0=Follow global settings, 1=Disabled
tax_accountVARCHAR(36)NULLThe uuid for tax account, If it is not NULL, tax will be paid to the specified account
permissionsMEDIUMTEXTEmpty JsonIndicates the override status of the store player permission group, serilized to JSON string
extraLONGTEXTEmpty YamlUsed to store experimental settings of QuickShop Hikari or persistent data of other plugins
inv_wrapperVARCHAR(255) NOT NULLN/AUnique identifier for InventoryWrapper for this shop data entry
inv_symbol_linkTEXT NOT NULLN/AUnique Inventory symbol used to pass to InventoryWrapper, for locating inventory
create_timeDATETIME NOT NULLDataset Insert TimeIndicates when this store was created
benefitMEDIUMTEXTN/ASetup 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.

项目名称数据类型默认值说明
idINT UNSIGNED Primary KeyAuto IncrementRecord ID (aka. shop_id)
data_idINT UNSIGNED NOT NULLN/AData 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.

项目名称数据类型默认值说明
worldVARCHAR(32) NOT NULLN/AThe world name in Bukkit
xINT NOT NULLN/AThe block X position for this shop
yINT NOT NULLN/AThe block Y position for this shop
zINT NOT NULLN/AThe block Z position for this shop

messages

This table is used to store offline messages.

项目名称数据类型默认值说明
idINT UNSIGNED Primary KeyAuto IncrementRecord ID
receiverVARCHAR(36) NOT NULLN/AThe unique id for receiver
timeDATETIMEDataset Insert TimeThe time that this message created
contentMEDIUMTEXT NOT NULLN/ASerialized Adventure Component

metadata

This table is used to store the metadata, e.g database schema version.

项目名称数据类型默认值说明
keyVARCHAR(255) NOT NULL Primary KeyN/AThe key
valueLONGTEXT NOT NULLN/AThe value

player

This table is used to store the player data, e.g locales.

项目名称数据类型默认值说明
uuidVARCHAR(36) NOT NULL Primary KeyN/AThe player unique id
localeVARCHAR(255) NOT NULLN/AThe player's client locale
cachedNameVARCHAR(255) NOT NULLN/AThe player's username last known

external_cache

This table is stored cached shop space/stock for WebUI or what else other pure database apps.

项目名称数据类型默认值说明
shopINT UNSIGNED NOT NULL Primary KeyN/AThe id of shop (aka. shop_id)
stockINT NOT NULLN/AThe stock for this shop
spaceINT NOT NULLN/AThe space for this shop

log_purchase

This table records all history purchases activities on this server.

项目名称数据类型默认值说明
idINT UNSIGNED Primary KeyAuto IncrementRecord ID
timeDATETIME NOT NULLDataset Insert TimeThe time that this purchase created
shopINT UNSIGNED NOT NULLN/AThe shop id (aka. shop_id)
数据INT UNSIGNED NOT NULLN/AThe data id (aka. data_id)
buyerVARCHAR(36) NOT NULLN/AThe purchaser unique id, In fact, it is more accurate to call it a purchaser, not only selling but also buying
typeVARCHAR(32) NOT NULLN/AThe ShopType enum name
amountINT NOT NULLN/APurchased stack amount
moneyDECIMAL(32,2) NOT NULLN/ATotal balance in this purchase
tax_amountDECIMAL(32,2) NOT NULL0The tax in this purchase

log_transaction

TODO

log_changes

TODO

log_others

TODO