You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Duplicate rows in tables. For now shop doesn't have any foreign links between tables, sqlite3 supports it, mysql - supports it too. So why it didn't used before, mystery 😮
To Reproduce
If there are no primary key on shop_players, then each other table have multiple rows of the same player_id. (It works only if there are no primary key in shop_players)
Expected behavior
Nothing will break in database, so we won't see 'Data is loading' information message.
Server (please complete the following information):
OS: any
Sourcemod version: 1.10+
Version: 3.0D4
On sqlite i rewrote SQL query on table creation. shop_toggles
CREATETABLEshop_toggles (
id INTEGERPRIMARY KEY AUTOINCREMENT,
player_id INTEGERNOT NULLREFERENCES shop_players (id) ON DELETE CASCADEONUPDATE CASCADE,
item_id INTEGERNOT NULLREFERENCES shop_items (id) ON DELETE CASCADEONUPDATE CASCADE,
state INTEGERNOT NULL
DEFAULT 0
);
CREATEUNIQUE INDEXtoggles_player_item_uniqON shop_toggles (
player_id,
item_id
);
shop_items - must handle future problems with 2 same items
I found a problem with cascade updating/deleting, sourcemod doesn't hook any changes in database, so such changes can corrupt player inventories in game.
I found a problem with cascade updating/deleting, sourcemod doesn't hook any changes in database, so such changes can corrupt player inventories in game.
Привязки ключей, в целом, не нужны особо, но для полноты описания, добавить можно.
Лучше сделайте индексацию на поля, по которым ведется поиск в условиях WHERE
Не знаю, в SQLite поддерживается ли это, а в MySQL это необходимо
Describe the bug
Duplicate rows in tables. For now shop doesn't have any foreign links between tables, sqlite3 supports it, mysql - supports it too. So why it didn't used before, mystery 😮
To Reproduce
If there are no primary key on shop_players, then each other table have multiple rows of the same player_id. (It works only if there are no primary key in shop_players)
Expected behavior
Nothing will break in database, so we won't see 'Data is loading' information message.
Server (please complete the following information):
On sqlite i rewrote SQL query on table creation.
shop_toggles
shop_items - must handle future problems with 2 same items
shop_boughts
The text was updated successfully, but these errors were encountered: