From 102dad49e727059441d5566d317e8a57def08b2d Mon Sep 17 00:00:00 2001
From: Florian Pritz <bluewind@xinu.at>
Date: Sat, 15 Apr 2017 20:31:38 +0200
Subject: schema: Fix invalid NULL on primary key

>From the mysql 5.7 breaking change page:

Columns in a PRIMARY KEY must be NOT NULL, but if declared explicitly as
NULL produced no error. Now an error occurs. For example, a statement
such as CREATE TABLE t (i INT NULL PRIMARY KEY) is rejected. The same
occurs for similar ALTER TABLE statements. (Bug #13995622, Bug #66987,
Bug #15967545, Bug #16545198)

References:
http://stackoverflow.com/a/22314073

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
---
 schema/aur-schema.sql | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'schema/aur-schema.sql')

diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql
index b3e4ecbb..89167b32 100644
--- a/schema/aur-schema.sql
+++ b/schema/aur-schema.sql
@@ -373,7 +373,7 @@ CREATE TABLE IF NOT EXISTS TU_Votes (
 -- Malicious user banning
 --
 CREATE TABLE Bans (
-	IPAddress VARCHAR(45) NULL DEFAULT NULL,
+	IPAddress VARCHAR(45) NOT NULL,
 	BanTS TIMESTAMP NOT NULL,
 	PRIMARY KEY (IPAddress)
 ) ENGINE = InnoDB;
-- 
cgit v1.2.3-24-g4f1b

