fix db
This commit is contained in:
@@ -42,6 +42,10 @@ public class DatabaseMigrationRunner implements CommandLineRunner {
|
|||||||
"storycove_secret"
|
"storycove_secret"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// SQL for last_completed_at column migration (idempotent)
|
||||||
|
private static final String LAST_COMPLETED_AT_MIGRATION =
|
||||||
|
"ALTER TABLE stories ADD COLUMN IF NOT EXISTS last_completed_at TIMESTAMP;";
|
||||||
|
|
||||||
// SQL for backup_jobs table migration (idempotent)
|
// SQL for backup_jobs table migration (idempotent)
|
||||||
private static final String BACKUP_JOBS_MIGRATION = """
|
private static final String BACKUP_JOBS_MIGRATION = """
|
||||||
CREATE TABLE IF NOT EXISTS backup_jobs (
|
CREATE TABLE IF NOT EXISTS backup_jobs (
|
||||||
@@ -100,12 +104,17 @@ public class DatabaseMigrationRunner implements CommandLineRunner {
|
|||||||
dbUsername,
|
dbUsername,
|
||||||
dbPassword
|
dbPassword
|
||||||
)) {
|
)) {
|
||||||
|
// Apply last_completed_at column migration
|
||||||
|
try (Statement stmt = conn.createStatement()) {
|
||||||
|
stmt.execute(LAST_COMPLETED_AT_MIGRATION);
|
||||||
|
}
|
||||||
|
|
||||||
// Apply backup_jobs migration
|
// Apply backup_jobs migration
|
||||||
try (Statement stmt = conn.createStatement()) {
|
try (Statement stmt = conn.createStatement()) {
|
||||||
stmt.execute(BACKUP_JOBS_MIGRATION);
|
stmt.execute(BACKUP_JOBS_MIGRATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Applied backup_jobs migration to {}", database);
|
logger.debug("Applied migrations to {}", database);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user