[aur-dev] [PATCH 1/2] Add "Bans" table to database schema

canyonknight canyonknight at gmail.com
Tue Mar 19 20:17:58 EDT 2013


The "Bans" table creates a DB structure for the ability to ban IP
addresses. It takes an IP address converted by ip2long(). It can easily
be extended for other features such as time limits (for temporary bans).

The table will eventually be able to be populated directly through
the web interface by Trusted Users and Developers.

Signed-off-by: canyonknight <canyonknight at gmail.com>
---
 UPGRADING                     | 11 +++++++++++
 support/schema/aur-schema.sql |  9 +++++++++
 2 files changed, 20 insertions(+)

diff --git a/UPGRADING b/UPGRADING
index 9c05467..7d13c43 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -11,6 +11,17 @@ ALTER TABLE Users
 	ADD COLUMN LastLoginIPAddress INTEGER UNSIGNED NOT NULL DEFAULT 0;
 ----
 
+2. Add a new "Bans" table:
+
+----
+CREATE TABLE Bans (
+	ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+	IPAddress INTEGER UNSIGNED NOT NULL DEFAULT 0,
+	PRIMARY KEY (ID),
+	UNIQUE (IPAddress)
+) ENGINE = InnoDB;
+----
+
 From 2.0.0 to 2.1.0
 -------------------
 
diff --git a/support/schema/aur-schema.sql b/support/schema/aur-schema.sql
index fab40d6..2d268fa 100644
--- a/support/schema/aur-schema.sql
+++ b/support/schema/aur-schema.sql
@@ -213,3 +213,12 @@ CREATE TABLE IF NOT EXISTS TU_Votes (
   FOREIGN KEY (VoteID) REFERENCES TU_VoteInfo(ID) ON DELETE CASCADE,
   FOREIGN KEY (UserID) REFERENCES Users(ID) ON DELETE CASCADE
 ) ENGINE = InnoDB;
+
+-- Malicious user banning
+--
+CREATE TABLE Bans (
+	ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+	IPAddress INTEGER UNSIGNED NOT NULL DEFAULT 0,
+	PRIMARY KEY (ID),
+	UNIQUE (IPAddress)
+) ENGINE = InnoDB;
-- 
1.8.2



More information about the aur-dev mailing list