From 8ceb9ccc0cbb31ba06226fec229ffe70f48913df Mon Sep 17 00:00:00 2001 From: Hugo Levy-Falk Date: Sun, 8 Sep 2019 14:59:00 +0200 Subject: [PATCH] Fix migrations for MySQL --- CHANGELOG.md | 8 ++++++++ install_re2o.sh | 2 +- users/migrations/0028_auto_20160726_0227.py | 6 +++--- users/migrations/0034_auto_20161018_0037.py | 2 +- users/migrations/0052_ldapuser_shadowexpire.py | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3fb3951..4ec2e366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -187,3 +187,11 @@ OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + (...,...,) ``` Don't forget to run migrations afterwards. + +## MR 433 : upgrade django-ldapdb to 1.3.0 + +If you use MySQL, please run + +``` +SET GLOBAL SQL_MODE=ANSI_QUOTES; +``` diff --git a/install_re2o.sh b/install_re2o.sh index 49c34dc9..b8a8c87d 100755 --- a/install_re2o.sh +++ b/install_re2o.sh @@ -109,7 +109,7 @@ install_database() { mysql_command="CREATE DATABASE $db_name collate='utf8_general_ci'; CREATE USER '$username'@'localhost' IDENTIFIED BY '$password'; GRANT ALL PRIVILEGES ON $db_name.* TO '$username'@'localhost'; - FLUSH PRIVILEGES;" + FLUSH PRIVILEGES;SET GLOBAL SQL_MODE=ANSI_QUOTES;" if [ "$local_setup" == 1 ]; then echo "Setting up local MySQL server ..." diff --git a/users/migrations/0028_auto_20160726_0227.py b/users/migrations/0028_auto_20160726_0227.py index 8ff41d49..9593434d 100644 --- a/users/migrations/0028_auto_20160726_0227.py +++ b/users/migrations/0028_auto_20160726_0227.py @@ -54,9 +54,9 @@ class Migration(migrations.Migration): ), ], database_operations=[ - migrations.RunSQL('ALTER TABLE "users_ldapuser" ADD COLUMN "displayName" varchar(200) NULL;'), - migrations.RunSQL('ALTER TABLE "users_ldapuser" ADD COLUMN "sambaNTPassword" varchar(200) NULL;'), - migrations.RunSQL('ALTER TABLE "users_ldapuser" ADD COLUMN "userPassword" varchar(200) NULL;'), + migrations.RunSQL('ALTER TABLE users_ldapuser ADD COLUMN "displayName" varchar(200) NULL;'), + migrations.RunSQL('ALTER TABLE users_ldapuser ADD COLUMN "sambaNTPassword" varchar(200) NULL;'), + migrations.RunSQL('ALTER TABLE users_ldapuser ADD COLUMN "userPassword" varchar(200) NULL;'), ] ), migrations.AddField( diff --git a/users/migrations/0034_auto_20161018_0037.py b/users/migrations/0034_auto_20161018_0037.py index 0e3519c1..e26e2373 100644 --- a/users/migrations/0034_auto_20161018_0037.py +++ b/users/migrations/0034_auto_20161018_0037.py @@ -45,7 +45,7 @@ class Migration(migrations.Migration): ), ], database_operations=[ - migrations.RunSQL('ALTER TABLE "users_ldapuser" ADD COLUMN "loginShell" varchar(200) NULL;') + migrations.RunSQL('ALTER TABLE users_ldapuser ADD COLUMN "loginShell" varchar(200) NULL;') ], ), migrations.AddField( diff --git a/users/migrations/0052_ldapuser_shadowexpire.py b/users/migrations/0052_ldapuser_shadowexpire.py index cbc24781..3948d2c9 100644 --- a/users/migrations/0052_ldapuser_shadowexpire.py +++ b/users/migrations/0052_ldapuser_shadowexpire.py @@ -22,7 +22,7 @@ class Migration(migrations.Migration): ), ], database_operations=[ - migrations.RunSQL('ALTER TABLE "users_ldapuser" ADD COLUMN "shadowExpire" varchar(200) NULL;'), + migrations.RunSQL('ALTER TABLE users_ldapuser ADD COLUMN "shadowExpire" varchar(200) NULL;'), ] ), ]