Commit 1222c08d authored by akwizgran's avatar akwizgran

Add migration that drops offers table.

parent 45020230
Pipeline #3620 passed with stage
in 8 minutes and 37 seconds
......@@ -98,7 +98,7 @@ import static org.briarproject.bramble.util.LogUtils.now;
abstract class JdbcDatabase implements Database<Connection> {
// Package access for testing
static final int CODE_SCHEMA_VERSION = 48;
static final int CODE_SCHEMA_VERSION = 49;
// Time period offsets for incoming transport keys
private static final int OFFSET_PREV = -1;
......@@ -457,7 +457,6 @@ abstract class JdbcDatabase implements Database<Connection> {
// Package access for testing
List<Migration<Connection>> getMigrations() {
return asList(
// TODO: Add migration that drops offers table
new Migration38_39(),
new Migration39_40(),
new Migration40_41(dbTypes),
......@@ -467,7 +466,8 @@ abstract class JdbcDatabase implements Database<Connection> {
new Migration44_45(),
new Migration45_46(),
new Migration46_47(dbTypes),
new Migration47_48(dbTypes)
new Migration47_48(dbTypes),
new Migration48_49()
);
}
......
package org.briarproject.bramble.db;
import org.briarproject.bramble.api.db.DbException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Logger;
import static java.util.logging.Level.WARNING;
import static java.util.logging.Logger.getLogger;
import static org.briarproject.bramble.db.JdbcUtils.tryToClose;
class Migration48_49 implements Migration<Connection> {
private static final Logger LOG = getLogger(Migration48_49.class.getName());
@Override
public int getStartVersion() {
return 48;
}
@Override
public int getEndVersion() {
return 49;
}
@Override
public void migrate(Connection txn) throws DbException {
Statement s = null;
try {
s = txn.createStatement();
s.execute("DROP TABLE offers");
s.close();
} catch (SQLException e) {
tryToClose(s, LOG, WARNING);
throw new DbException(e);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment