2023-05-25 19:20:03 +02:00
|
|
|
package com.craftaro.ultimatestacker.database.migrations;
|
2020-08-25 01:01:11 +02:00
|
|
|
|
2023-05-30 11:21:46 +02:00
|
|
|
import com.craftaro.ultimatestacker.UltimateStacker;
|
2023-06-11 13:14:56 +02:00
|
|
|
import com.craftaro.core.database.DataMigration;
|
|
|
|
import com.craftaro.core.database.DatabaseConnector;
|
|
|
|
import com.craftaro.core.database.MySQLConnector;
|
2020-08-25 01:01:11 +02:00
|
|
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.sql.Statement;
|
|
|
|
|
|
|
|
public class _3_BlockStacks extends DataMigration {
|
|
|
|
|
|
|
|
public _3_BlockStacks() {
|
|
|
|
super(3);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2023-06-05 16:25:37 +02:00
|
|
|
public void migrate(DatabaseConnector connector, String tablePrefix) throws SQLException {
|
|
|
|
String autoIncrement = connector instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
|
2020-08-25 01:01:11 +02:00
|
|
|
|
|
|
|
// Create blocks table
|
2023-06-05 16:25:37 +02:00
|
|
|
try (Statement statement = connector.getConnection().createStatement()) {
|
2023-01-25 23:20:44 +01:00
|
|
|
statement.execute("CREATE TABLE IF NOT EXISTS " + tablePrefix + "blocks (" +
|
2020-08-25 01:01:11 +02:00
|
|
|
"id INTEGER PRIMARY KEY" + autoIncrement + ", " +
|
|
|
|
"amount INTEGER NOT NULL," +
|
2020-10-19 20:26:18 +02:00
|
|
|
"material TEXT NOT NULL," +
|
2020-08-25 01:01:11 +02:00
|
|
|
"world TEXT NOT NULL, " +
|
|
|
|
"x DOUBLE NOT NULL, " +
|
|
|
|
"y DOUBLE NOT NULL, " +
|
|
|
|
"z DOUBLE NOT NULL " +
|
|
|
|
")");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|