deploy: 08c1ba09e86a0285abfb8cc18d77db9056a6c7a0

This commit is contained in:
jm-clius 2021-12-07 12:43:34 +00:00
parent 65ca47b2a9
commit 42e07461e2
3 changed files with 9 additions and 3 deletions

View File

@ -22,6 +22,8 @@ CREATE TABLE IF NOT EXISTS Message(
) WITHOUT ROWID;
INSERT INTO Message SELECT id, timestamp, contentTopic, pubsubTopic, payload, version, 0 FROM Message_backup;
INSERT INTO Message (id, receiverTimestamp, contentTopic, pubsubTopic, payload, version, senderTimestamp)
SELECT id, timestamp, contentTopic, pubsubTopic, payload, version, 0
FROM Message_backup;
DROP TABLE Message_backup;

View File

@ -247,6 +247,7 @@ proc migrate*(db: SqliteDatabase, path: string, targetVersion: int64 = migration
ok(true)
else:
info "database user_version outdated. migrating.", userVersion=userVersion, targetVersion=targetVersion
# TODO check for the down migrations i.e., userVersion.value > tragetVersion
# fetch migration scripts
let migrationScriptsRes = getScripts(path)
@ -260,6 +261,9 @@ proc migrate*(db: SqliteDatabase, path: string, targetVersion: int64 = migration
return err("failed to filter migration scripts")
let scripts = scriptsRes.value
if (scripts.len == 0):
return err("no suitable migration scripts")
debug "scripts to be run", scripts=scripts

View File

@ -107,9 +107,9 @@ proc runMigrations*(sqliteDatabase: SqliteDatabase, conf: WakuNodeConf) =
migrationPath = migration_types.MESSAGE_STORE_MIGRATION_PATH
# run migration
info "running migration ... "
info "running migration ...", migrationPath=migrationPath
let migrationResult = sqliteDatabase.migrate(migrationPath)
if migrationResult.isErr:
warn "migration failed"
warn "migration failed", error=migrationResult.error
else:
info "migration is done"