mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-02-13 18:51:19 +01:00
create new statistic enum&class, and migration
Took 7 minutes
This commit is contained in:
parent
768fd2c45a
commit
55dd436e9d
@ -185,7 +185,8 @@ public class AuctionHouse extends TweetyPlugin {
|
||||
new _12_SerializeFormatDropMigration(),
|
||||
new _13_MinItemPriceMigration(),
|
||||
new _14_PartialQtyBuyMigration(),
|
||||
new _15_AuctionPlayerMigration()
|
||||
new _15_AuctionPlayerMigration(),
|
||||
new _16_StatisticVersionTwoMigration()
|
||||
);
|
||||
|
||||
dataMigrationManager.runMigrations();
|
||||
|
@ -13,6 +13,7 @@ import lombok.Setter;
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@Deprecated
|
||||
public final class AuctionStat<Created, Sold, Expired, Earned, Spent> {
|
||||
|
||||
private Created created;
|
||||
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Auction House
|
||||
* Copyright 2022 Kiran Hart
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package ca.tweetzy.auctionhouse.auction;
|
||||
|
||||
import ca.tweetzy.auctionhouse.auction.enums.AuctionStatisticType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public final class AuctionStatistic {
|
||||
|
||||
private final UUID statOwner;
|
||||
private final AuctionStatisticType statisticType;
|
||||
private final double value;
|
||||
private final long time;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Auction House
|
||||
* Copyright 2022 Kiran Hart
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package ca.tweetzy.auctionhouse.auction.enums;
|
||||
|
||||
public enum AuctionStatisticType {
|
||||
|
||||
CREATED_AUCTION,
|
||||
CREATED_BIN,
|
||||
|
||||
SOLD_AUCTION,
|
||||
SOLD_BIN,
|
||||
|
||||
MONEY_SPENT,
|
||||
MONEY_EARNED
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package ca.tweetzy.auctionhouse.database.migrations;
|
||||
|
||||
import ca.tweetzy.auctionhouse.AuctionHouse;
|
||||
import ca.tweetzy.core.database.DataMigration;
|
||||
import ca.tweetzy.core.database.MySQLConnector;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* The current file has been created by Kiran Hart
|
||||
* Date Created: September 08 2022
|
||||
* Time Created: 9:13 a.m.
|
||||
* Usage of any code found within this class is prohibited unless given explicit permission otherwise
|
||||
*/
|
||||
public class _16_StatisticVersionTwoMigration extends DataMigration {
|
||||
|
||||
public _16_StatisticVersionTwoMigration() {
|
||||
super(16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrate(Connection connection, String tablePrefix) throws SQLException {
|
||||
|
||||
String autoIncrement = AuctionHouse.getInstance().getDatabaseConnector() instanceof MySQLConnector ? " AUTO_INCREMENT" : "";
|
||||
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
statement.execute("CREATE TABLE " + tablePrefix + "statistic (" +
|
||||
"id INTEGER PRIMARY KEY" + autoIncrement + ", " +
|
||||
"stat_owner VARCHAR(36) NOT NULL, " +
|
||||
"stat_type VARCHAR(20) NOT NULL, " +
|
||||
"value DOUBLE NOT NULL, " +
|
||||
"time LONG NOT NULL" +
|
||||
")");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user