mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-07 04:18:26 +02:00
Fixed Mysql date conversion sql
This commit is contained in:
parent
09c8955096
commit
e51e6f4194
@ -56,12 +56,12 @@ public interface Sql {
|
||||
|
||||
@Override
|
||||
public String dateFromEpochSecond(String sql) {
|
||||
return "FROM UNIXTIME(" + sql + ')';
|
||||
return "FROM_UNIXTIME(" + sql + ')';
|
||||
}
|
||||
|
||||
@Override
|
||||
public String epochSecondFromDate(String sql) {
|
||||
return "UNIX TIMESTAMP(" + sql + ')';
|
||||
return "UNIX_TIMESTAMP(" + sql + ')';
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,21 +25,15 @@ import com.djrapitops.plan.db.access.transactions.init.CreateTablesTransaction;
|
||||
import com.djrapitops.plan.db.patches.KillsOptimizationPatch;
|
||||
import com.djrapitops.plan.db.patches.Patch;
|
||||
import com.djrapitops.plan.system.PlanSystem;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.system.settings.paths.DatabaseSettings;
|
||||
import com.djrapitops.plan.system.settings.paths.WebserverSettings;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.junit.platform.runner.JUnitPlatform;
|
||||
import org.junit.runner.RunWith;
|
||||
import utilities.CIProperties;
|
||||
import utilities.OptionalAssert;
|
||||
import utilities.RandomData;
|
||||
import utilities.TestConstants;
|
||||
import utilities.*;
|
||||
import utilities.mocks.PluginMockComponent;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
||||
@ -74,10 +68,8 @@ class DBPatchMySQLRegressionTest extends DBPatchRegressionTest {
|
||||
private MySQLDB underTest;
|
||||
|
||||
@BeforeAll
|
||||
static void ensureCIServiceInUse(@TempDir Path tempDir) {
|
||||
boolean isCI = Boolean.parseBoolean(System.getenv(CIProperties.IS_CI_SERVICE));
|
||||
assumeTrue(isCI);
|
||||
|
||||
static void ensureMySQLAvailable(@TempDir Path tempDir) {
|
||||
assumeTrue(System.getenv(CIProperties.MYSQL_DATABASE) != null);
|
||||
component = new PluginMockComponent(tempDir);
|
||||
}
|
||||
|
||||
@ -100,19 +92,10 @@ class DBPatchMySQLRegressionTest extends DBPatchRegressionTest {
|
||||
@BeforeEach
|
||||
void setUpDBWithOldSchema() throws Exception {
|
||||
PlanSystem system = component.getPlanSystem();
|
||||
PlanConfig config = system.getConfigSystem().getConfig();
|
||||
config.set(DatabaseSettings.MYSQL_DATABASE, "Plan");
|
||||
config.set(DatabaseSettings.MYSQL_USER, "travis");
|
||||
config.set(DatabaseSettings.MYSQL_PASS, "");
|
||||
config.set(DatabaseSettings.MYSQL_HOST, "127.0.0.1");
|
||||
config.set(DatabaseSettings.TYPE, "MySQL");
|
||||
config.set(WebserverSettings.PORT, TEST_PORT_NUMBER);
|
||||
Optional<Database> db = new DBPreparer(system, TEST_PORT_NUMBER).prepareMySQL();
|
||||
assumeTrue(db.isPresent());
|
||||
|
||||
system.enable();
|
||||
|
||||
underTest = (MySQLDB) system.getDatabaseSystem().getActiveDatabaseByName(DBType.MYSQL.getName());
|
||||
underTest.setTransactionExecutorServiceProvider(MoreExecutors::newDirectExecutorService);
|
||||
underTest.init();
|
||||
underTest = (MySQLDB) db.get();
|
||||
|
||||
dropAllTables();
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class SeleniumExtension implements ParameterResolver, BeforeAllCallback,
|
||||
}
|
||||
|
||||
private WebDriver getChromeWebDriver() {
|
||||
if (Boolean.parseBoolean(System.getenv(CIProperties.IS_CI_SERVICE))) {
|
||||
if (System.getenv(CIProperties.CHROME_DRIVER) != null) {
|
||||
ChromeOptions chromeOptions = new ChromeOptions();
|
||||
chromeOptions.setBinary("/usr/bin/google-chrome-stable");
|
||||
chromeOptions.setHeadless(true);
|
||||
|
@ -23,8 +23,6 @@ package utilities;
|
||||
*/
|
||||
public class CIProperties {
|
||||
|
||||
@Deprecated
|
||||
public static final String IS_CI_SERVICE = "TRAVIS";
|
||||
public static final String MYSQL_DATABASE = "MYSQL_DB";
|
||||
// Notice to CI configurer: This user should only have local access.
|
||||
// (To prevent outside connections with CI user)
|
||||
|
Loading…
Reference in New Issue
Block a user