Open Lernos opened 3 years ago
Here's the actual solution. In migrations/v4.sql we need to replace
CREATE TABLE ip_bans_new( ipid TEXT PRIMARY KEY,
with
CREATE TABLE ip_bans_new( ipid INTEGER NOT NULL,
Since I have little experience with SQL, I'm not sure whether INTEGER NOT NULL or INTEGER PRIMARY KEY would be more applicable here, but the former, as I am inclined to repeat, is stonedDiscord's first glance intended solution.
Yeah, IPID shouldn't have been the PK. Smh (at myself)
Once an IPID ban has been logged into the database, the same IPID can never be banned again in the future, sending the following error into OOC: "Error inserting ban: UNIQUE constraint failed: ip_bans.ipid (the IPID may not exist)". As suggested by sD, this is fixable by changing ipid data type in ip_bans from TEXT PRIMARY KEY to INTEGER NOT NULL, but needs to be implemented in the code at database creation. Also, HDID bans haven't been tested.