Currently, there isn't an upgrade mechanism in place within the database which makes the current schema rigid and upgradeable. To remedy this, a new bucket should be added to the database (metaBucket) which stores key that house meta-data related to the current/version state of the database.
The createChannelDB method should be modified to create this new bucket+key during initializing. In a similar vein, when opening the database, the dbVersionKey should be read from the metaBucket and compared against some compile-time constant which stores the latest known database version. If the two versions differ (after some future database update/migration), logic should be inserted to convert the old format to the newly defined format. Additionally, it may be advisable to fist make a complete copy of the current database using bolt db's WriteToMethod as a fail-safe in case of bugs or failures during the database migration.
Currently, there isn't an upgrade mechanism in place within the database which makes the current schema rigid and upgradeable. To remedy this, a new bucket should be added to the database (
metaBucket) which stores key that house meta-data related to the current/version state of the database.The
createChannelDBmethod should be modified to create this new bucket+key during initializing. In a similar vein, when opening the database, thedbVersionKeyshould be read from themetaBucketand compared against some compile-time constant which stores the latest known database version. If the two versions differ (after some future database update/migration), logic should be inserted to convert the old format to the newly defined format. Additionally, it may be advisable to fist make a complete copy of the current database using bolt db'sWriteToMethodas a fail-safe in case of bugs or failures during the database migration.