Public Access
feat(library): let auditors merge duplicate games
An auditor merges a game added by hand into its Steam game or another game added by hand (V21). Every user's row moves; a user with both rows keeps one, with the status, rating and notes set by hand. game_alias sends later adds to the kept key, and admin_audit logs who merged what. The game search shows games already in ToBePlayed first.
This commit is contained in:
1 parent
3c2f40036d
commit
5a089b2082
14 files changed
+804
-44
No files matched your search
@@ -0,0 +1,24 @@
|
||||
-- An auditor's merge of two library keys of the same game: from_appid (always minus an IGDB id) now lives under
|
||||
-- to_appid, so a later add of the from game lands there. Kept flat: no to_appid is also a from_appid.
|
||||
CREATE TABLE game_alias (
|
||||
from_appid BIGINT PRIMARY KEY,
|
||||
to_appid BIGINT NOT NULL
|
||||
);
|
||||
|
||||
-- One row per auditor or admin action in Core, like Auth's admin_audit. No foreign keys: the rows outlive the game
|
||||
-- rows and the users. detail keeps the names, since the from game's catalog row is deleted.
|
||||
CREATE TABLE admin_audit (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
actor_user_id BIGINT NOT NULL,
|
||||
action VARCHAR(32) NOT NULL,
|
||||
appid BIGINT,
|
||||
target_appid BIGINT,
|
||||
detail TEXT,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- A merge moves user_game rows to another appid; their status history moves with them.
|
||||
ALTER TABLE user_game_status_change
|
||||
DROP CONSTRAINT user_game_status_change_user_id_appid_fkey,
|
||||
ADD CONSTRAINT user_game_status_change_user_id_appid_fkey FOREIGN KEY (user_id, appid)
|
||||
REFERENCES user_game (user_id, appid) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
Reference in new issue
Block a user