Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Any user, once banned by IPID once, cannot be banned again #171

Open
Lernos opened this issue Apr 30, 2021 · 2 comments
Open

Any user, once banned by IPID once, cannot be banned again #171

Lernos opened this issue Apr 30, 2021 · 2 comments

Comments

@Lernos
Copy link
Contributor

Lernos commented Apr 30, 2021

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.

@Lernos
Copy link
Contributor Author

Lernos commented May 2, 2021

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.

@oldmud0
Copy link
Member

oldmud0 commented May 3, 2021

Yeah, IPID shouldn't have been the PK. Smh (at myself)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants