add new db tables #13
@@ -201,6 +201,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
stmt.executeUpdate(Migrations.CREATE_TABLE_PLAYERS);
|
stmt.executeUpdate(Migrations.CREATE_TABLE_PLAYERS);
|
||||||
stmt.executeUpdate(Migrations.CREATE_TABLE_ACTIONS);
|
stmt.executeUpdate(Migrations.CREATE_TABLE_ACTIONS);
|
||||||
stmt.executeUpdate(Migrations.CREATE_TABLE_ALERTS);
|
stmt.executeUpdate(Migrations.CREATE_TABLE_ALERTS);
|
||||||
|
stmt.executeUpdate(Migrations.CREATE_TABLE_REPORTS);
|
||||||
stmt.close();
|
stmt.close();
|
||||||
getLogger().info("Connected to "+jdbcUrl);
|
getLogger().info("Connected to "+jdbcUrl);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.ardakaz.griefalert;
|
package net.ardakaz.griefalert;
|
||||||
|
|
||||||
public class Migrations {
|
public class Migrations {
|
||||||
|
|
||||||
public static final String CREATE_TABLE_IGNORED_LOCATIONS =
|
public static final String CREATE_TABLE_IGNORED_LOCATIONS =
|
||||||
"CREATE TABLE IF NOT EXISTS ignored_locations (" +
|
"CREATE TABLE IF NOT EXISTS ignored_locations (" +
|
||||||
"x INTEGER, " +
|
"x INTEGER, " +
|
||||||
@@ -9,6 +10,7 @@ public class Migrations {
|
|||||||
"world TEXT, " +
|
"world TEXT, " +
|
||||||
"PRIMARY KEY (x, y, z, world)" +
|
"PRIMARY KEY (x, y, z, world)" +
|
||||||
")";
|
")";
|
||||||
|
|
||||||
public static final String CREATE_TABLE_PLAYERS =
|
public static final String CREATE_TABLE_PLAYERS =
|
||||||
"CREATE TABLE IF NOT EXISTS players (" +
|
"CREATE TABLE IF NOT EXISTS players (" +
|
||||||
"id TEXT PRIMARY KEY, " +
|
"id TEXT PRIMARY KEY, " +
|
||||||
@@ -29,6 +31,7 @@ public class Migrations {
|
|||||||
"timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
|
"timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
|
||||||
"FOREIGN KEY(player) REFERENCES players(id)" +
|
"FOREIGN KEY(player) REFERENCES players(id)" +
|
||||||
")";
|
")";
|
||||||
|
|
||||||
public static final String CREATE_TABLE_ALERTS =
|
public static final String CREATE_TABLE_ALERTS =
|
||||||
"CREATE TABLE IF NOT EXISTS alerts (" +
|
"CREATE TABLE IF NOT EXISTS alerts (" +
|
||||||
"id INTEGER PRIMARY KEY, " +
|
"id INTEGER PRIMARY KEY, " +
|
||||||
@@ -48,4 +51,18 @@ public class Migrations {
|
|||||||
"timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
|
"timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
|
||||||
"FOREIGN KEY(player) REFERENCES players(id)" +
|
"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'" +
|
||||||
|
")";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user