mirror of
https://github.com/kiranhart/Auction-House.git
synced 2024-11-21 05:15:11 +01:00
yes
Took 15 minutes
This commit is contained in:
parent
309af4bd02
commit
4ed56d6a74
@ -185,7 +185,8 @@ public class AuctionHouse extends TweetyPlugin {
|
||||
new _23_ItemToNBTSerializationMigration(),
|
||||
new _24_RemainingItemToNBTSerializationMigration(),
|
||||
new _25_BidHistoryMigration(),
|
||||
new _26_MultiSerAndCurrencyMigration()
|
||||
new _26_MultiSerAndCurrencyMigration(),
|
||||
new _27_FixMigration25to26Migration()
|
||||
);
|
||||
|
||||
dataMigrationManager.runMigrations();
|
||||
|
@ -314,9 +314,11 @@ public class DataManager extends DataManagerAbstract {
|
||||
|
||||
if (resultSet.getInt("serialize_version") == 0) {
|
||||
try (PreparedStatement updateStatement = connection.prepareStatement("UPDATE " + this.getTablePrefix() + "auctions SET serialize_version = 1, itemstack = ? WHERE id = ?")) {
|
||||
updateStatement.setString(1, QuickItem.toString(item.getItem()));
|
||||
updateStatement.setString(2, resultSet.getString("id"));
|
||||
updateStatement.executeUpdate();
|
||||
try {
|
||||
updateStatement.setString(1, QuickItem.toString(item.getItem()));
|
||||
updateStatement.setString(2, resultSet.getString("id"));
|
||||
updateStatement.executeUpdate();
|
||||
} catch (NbtApiException ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -934,7 +936,14 @@ public class DataManager extends DataManagerAbstract {
|
||||
if (possibleItem.contains("Head Database"))
|
||||
possibleItem = possibleItem.replace("Head Database", "HeadDatabase");
|
||||
|
||||
ItemStack item = resultSet.getInt("serialize_version") == 1 ? QuickItem.getItem(resultSet.getString("itemstack")) : AuctionAPI.decodeItemTransaction(possibleItem);
|
||||
|
||||
ItemStack item = null;
|
||||
|
||||
if (resultSet.getInt("serialize_version") == 1)
|
||||
item = QuickItem.getItem(resultSet.getString("itemstack"));
|
||||
|
||||
// AuctionAPI.decodeItemTransaction(possibleItem);
|
||||
if (item == null) return null;
|
||||
|
||||
return new Transaction(
|
||||
UUID.fromString(resultSet.getString("id")),
|
||||
|
@ -0,0 +1,35 @@
|
||||
package ca.tweetzy.auctionhouse.database.migrations;
|
||||
|
||||
import ca.tweetzy.flight.database.DataMigration;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
public final class _27_FixMigration25to26Migration extends DataMigration {
|
||||
|
||||
public _27_FixMigration25to26Migration() {
|
||||
super(27);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrate(Connection connection, String tablePrefix) throws SQLException {
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
statement.execute("ALTER TABLE " + tablePrefix + "auctions DROP COLUMN currency");
|
||||
statement.execute("ALTER TABLE " + tablePrefix + "auctions ADD currency VARCHAR(70) DEFAULT 'Vault/Vault'");
|
||||
|
||||
statement.execute("DROP TABLE " + tablePrefix + "bids;");
|
||||
statement.execute("CREATE TABLE " + tablePrefix + "bids (" +
|
||||
"id VARCHAR(36) NOT NULL PRIMARY KEY, " +
|
||||
"listing_id VARCHAR(36) NOT NULL, " +
|
||||
"bidder_uuid VARCHAR(36) NOT NULL, " +
|
||||
"bidder_name VARCHAR(16) NOT NULL, " +
|
||||
"currency VARCHAR(70) NOT NULL DEFAULT 'Vault/Vault'," +
|
||||
"currency_item TEXT NULL," +
|
||||
"amount DOUBLE NOT NULL, " +
|
||||
"world VARCHAR(126) NOT NULL, " +
|
||||
"server VARCHAR(80) NOT NULL, " +
|
||||
"created_at BigInt NOT NULL )");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user