#792 #814 Implement SQLite migration, allow last IP to be nullable in MySQL

- Old SQLite setups have the last IP column as NOT NULL but without a default value. With the new concept (where we don't set a last IP on player registration) it fails.
  - Create an /authme debug child that allows to migrate SQLite (tricky because SQLite does not support dropping or modifying columns)
  - Allow last IP column to be NOT NULL in MySQL as well (extend MySQL /authme debug child)
- Add TODO comments with follow-up issue to extend our commands with new registration IP field
This commit is contained in:
ljacqu
2017-10-21 10:24:40 +02:00
parent b5ea48085c
commit 1651a61063
29 changed files with 688 additions and 130 deletions
@@ -121,7 +121,7 @@ public class EmailRegisterExecutorProviderTest {
PlayerAuth auth = executor.buildPlayerAuth(params);
// then
assertThat(auth, hasAuthBasicData("veronica", "Veronica", "test@example.com", "127.0.0.1"));
assertThat(auth, hasAuthBasicData("veronica", "Veronica", "test@example.com", null));
assertThat(auth.getRegistrationIp(), equalTo("123.45.67.89"));
assertIsCloseTo(auth.getRegistrationDate(), System.currentTimeMillis(), 1000);
assertThat(auth.getPassword().getHash(), stringWithLength(12));
@@ -103,7 +103,7 @@ public class PasswordRegisterExecutorTest {
PlayerAuth auth = executor.buildPlayerAuth(params);
// then
assertThat(auth, hasAuthBasicData("s1m0n", "S1m0N", "mail@example.org", "127.0.0.1"));
assertThat(auth, hasAuthBasicData("s1m0n", "S1m0N", "mail@example.org", null));
assertThat(auth.getRegistrationIp(), equalTo("123.45.67.89"));
assertIsCloseTo(auth.getRegistrationDate(), System.currentTimeMillis(), 500);
assertThat(auth.getPassword(), equalToHash("pass"));
@@ -33,7 +33,7 @@ public class PlayerAuthBuilderHelperTest {
PlayerAuth auth = PlayerAuthBuilderHelper.createPlayerAuth(player, hashedPassword, email);
// then
assertThat(auth, hasAuthBasicData("noah", "Noah", email, "127.0.0.1"));
assertThat(auth, hasAuthBasicData("noah", "Noah", email, null));
assertThat(auth.getRegistrationIp(), equalTo("192.168.34.47"));
assertThat(Math.abs(auth.getRegistrationDate() - System.currentTimeMillis()), lessThan(1000L));
assertThat(auth.getPassword(), equalToHash("myHash0001"));