[aur-dev] [PATCH 1/2] schema: Remove invalid default values for TEXT columns
When running in strict mode, mysql throws an error upon encountering these definitions since they are not supported. References: https://dev.mysql.com/doc/refman/5.7/en/data-type-defaults.html Signed-off-by: Florian Pritz <bluewind@xinu.at> --- schema/aur-schema.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql index b42b45d..b3e4ecb 100644 --- a/schema/aur-schema.sql +++ b/schema/aur-schema.sql @@ -80,7 +80,7 @@ CREATE TABLE PackageBases ( NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0, Popularity DECIMAL(10,6) UNSIGNED NOT NULL DEFAULT 0, OutOfDateTS BIGINT UNSIGNED NULL DEFAULT NULL, - FlaggerComment TEXT NOT NULL DEFAULT '', + FlaggerComment TEXT NOT NULL, SubmittedTS BIGINT UNSIGNED NOT NULL, ModifiedTS BIGINT UNSIGNED NOT NULL, FlaggerUID INTEGER UNSIGNED NULL DEFAULT NULL, -- who flagged the package out-of-date? @@ -253,7 +253,7 @@ CREATE TABLE PackageComments ( ID BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, PackageBaseID INTEGER UNSIGNED NOT NULL, UsersID INTEGER UNSIGNED NULL DEFAULT NULL, - Comments TEXT NOT NULL DEFAULT '', + Comments TEXT NOT NULL, CommentTS BIGINT UNSIGNED NOT NULL DEFAULT 0, EditedTS BIGINT UNSIGNED NULL DEFAULT NULL, EditedUsersID INTEGER UNSIGNED NULL DEFAULT NULL, @@ -331,8 +331,8 @@ CREATE TABLE PackageRequests ( PackageBaseName VARCHAR(255) NOT NULL, MergeBaseName VARCHAR(255) NULL, UsersID INTEGER UNSIGNED NULL DEFAULT NULL, - Comments TEXT NOT NULL DEFAULT '', - ClosureComment TEXT NOT NULL DEFAULT '', + Comments TEXT NOT NULL, + ClosureComment TEXT NOT NULL, RequestTS BIGINT UNSIGNED NOT NULL DEFAULT 0, Status TINYINT UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (ID), -- 2.12.2
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> --- schema/aur-schema.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql index b3e4ecb..89167b3 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; -- 2.12.2
On Sat, 15 Apr 2017 at 20:31:37, Florian Pritz via aur-dev wrote:
When running in strict mode, mysql throws an error upon encountering these definitions since they are not supported.
References: https://dev.mysql.com/doc/refman/5.7/en/data-type-defaults.html
Signed-off-by: Florian Pritz <bluewind@xinu.at> --- schema/aur-schema.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) [...]
Queued both patches on pu. Thanks!
participants (2)
-
Florian Pritz
-
Lukas Fleischer