add new db tables #13

Merged
Ardakaz merged 3 commits from db-schema into main 2026-07-18 18:24:27 +00:00
2 changed files with 18 additions and 0 deletions
Showing only changes of commit f45777c72a - Show all commits

View File

@@ -201,6 +201,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
stmt.executeUpdate(Migrations.CREATE_TABLE_PLAYERS);
stmt.executeUpdate(Migrations.CREATE_TABLE_ACTIONS);
stmt.executeUpdate(Migrations.CREATE_TABLE_ALERTS);
stmt.executeUpdate(Migrations.CREATE_TABLE_REPORTS);
stmt.close();
getLogger().info("Connected to "+jdbcUrl);
} catch (SQLException e) {

View File

@@ -1,6 +1,7 @@
package net.ardakaz.griefalert;
public class Migrations {
public static final String CREATE_TABLE_IGNORED_LOCATIONS =
"CREATE TABLE IF NOT EXISTS ignored_locations (" +
"x INTEGER, " +
@@ -9,6 +10,7 @@ public class Migrations {
"world TEXT, " +
"PRIMARY KEY (x, y, z, world)" +
")";
public static final String CREATE_TABLE_PLAYERS =
"CREATE TABLE IF NOT EXISTS players (" +
"id TEXT PRIMARY KEY, " +
@@ -29,6 +31,7 @@ public class Migrations {
"timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
"FOREIGN KEY(player) REFERENCES players(id)" +
")";
public static final String CREATE_TABLE_ALERTS =
"CREATE TABLE IF NOT EXISTS alerts (" +
"id INTEGER PRIMARY KEY, " +
@@ -48,4 +51,18 @@ public class Migrations {
"timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
"FOREIGN KEY(player) REFERENCES players(id)" +
")";
public static final String CREATE_TABLE_REPORTS =
"CREATE TABLE IF NOT EXISTS reports (" +
"id INTEGER PRIMARY KEY, " +
"player TEXT NOT NULL, " +
"x INTEGER NOT NULL, " +
"y INTEGER NOT NULL, " +
"z INTEGER NOT NULL, " +
"world TEXT NOT NULL, " +
"text TEXT NOT NULL, " +
"resolved_by TEXT, " +
"timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
"state TEXT NOT NULL DEFAULT 'UNRESOLVED'" +
")";
}