Skip to main content

Database Schema

This chapter will explain the implementation details of QuickShop Hikari's database storage format.

Tables

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

資料

This data table stores all the existing store data on this server or the store data that has been deleted but is still referenced in a specific form, and does not contain coordinate information.
No matter what, a data record should not be modified after it is created, until it got deleted.
Any new changes to the shop should create a new copy, apply the changes to the copy, and insert it as a new record.

Basiclly, Copy-on-write.

A data record only be deleted from the database when no any table references their data_id.

Column Name資料類型預設Description
idINT UNSIGNED Primary KeyAuto IncrementRecord ID (aka. data_id)
ownerVARCHAR(36) NOT NULLN/AThe shop owner unique id (aka. UUID)
物品TEXT NOT NULLN/AYAML serialized ItemStack for this shop data entry
類型INT 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
價格DECIMAL(32,2) NOT NULLN/AThe price per stack for this shop data entry
無限BIT 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

商店

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.

Column Name資料類型預設Description
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.

Column Name資料類型預設Description
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.

Column Name資料類型預設Description
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.

Column Name資料類型預設Description
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.

Column Name資料類型預設Description
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.

Column Name資料類型預設Description
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.

Column Name資料類型預設Description
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
類型VARCHAR(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