Migration Guide¶
Guide for upgrading between versions of CongraphDB.
Version 0.0.x to 0.1.x¶
Breaking Changes¶
None. 0.1.x is backward compatible with 0.0.x.
New Features¶
- Improved query optimizer
- Better error messages
- Performance improvements
Migration Steps¶
-
Backup your database:
-
Update package:
-
Test your application:
- Run your test suite
- Verify query results
-
Check performance
-
Deploy when confident
Storage Version¶
Storage version may change between major versions:
// Check storage version
const currentVersion = Database.getStorageVersion();
console.log('Storage version:', currentVersion);
// v0.1.x uses storage version 1
Upgrading Best Practices¶
Before Upgrading¶
- Test in staging:
- Copy production database to staging
- Run full test suite
-
Monitor performance
-
Review changelog:
- Read CHANGELOG for breaking changes
-
Check GitHub issues for known problems
-
Plan rollback:
- Keep backups accessible
- Document downgrade process
During Upgrade¶
- Stop your application
- Backup database files (.cgraph and .wal)
- Update package
- Restart application
- Monitor logs for errors
After Upgrade¶
- Verify functionality:
- Key operations working
- Query results correct
-
Performance acceptable
-
Monitor for issues:
- Error rates
- Query latency
-
Memory usage
-
Keep backup until confident
Rollback Procedure¶
If you need to rollback:
- Stop your application
- Restore from backup:
- Reinstall previous version:
- Restart application
Data Migration¶
Schema Changes¶
When schema changes between versions:
// Check for migration needed
const db = new Database('./my-graph.cgraph');
db.init();
const conn = db.createConnection();
// Query storage version
const result = conn.querySync(`
CALL db.storageVersion()
`);
console.log('Storage version:', result.getNext().version);
Automatic Migrations¶
CongraphDB handles automatic migrations for compatible changes:
- New column types (if compatible)
- Index structure changes
- Storage format improvements
Manual Migrations¶
For breaking schema changes, you may need to export and reimport:
// Export data
const data = await conn.query(`
MATCH (n) RETURN n
`);
// Upgrade to new version
// Reimport data
for (const row of data) {
await conn.query(`
CREATE (n:NewSchema {props})
`, { props: row.n });
}
Storage Version Compatibility¶
| App Version | Storage Version | Notes |
|---|---|---|
| 0.0.x | 1 | Initial release |
| 0.1.x | 1 | Backward compatible |
Older app versions can open newer databases only if storage version is compatible.
See Also¶
- Changelog — Version history
- Storage Format — Internal format details