# Manually adding new fields in DB Object For example `add_pitchDiag` in object `DbTechLayer`. *Modifications in these steps need to be done inside user regions, delimited like the below, to avoid being rewritten by the code generator ```cpp // User Code Begin ... // User Code End ```
ActionFileSource Code
1 Add Fields at the .h file dbTechLayer.h In the class _dbTechLayer:
int _pitchDiag;
2 Increase the current rev number by one dbDatabase.h ``` cpp const uint32_t db_schema_minor = 52; ```
3 Define a keyword for the new db rev number dbDatabase.h ``` cpp const uint32_t db_schema_add_pitchDiag = 52; ```
4* Stream in new fields Conditionally upon Schema number dbTechLayer.cpp In the method dbIStream& operator>>: ``` cpp if (obj.getDatabase()->isSchema(db_schema_add_pitchDiag)) { stream >> obj._pitchDiag; } ```
5* Stream out new fields Conditionally upon Schema number dbTechLayer.cpp In the method dbOStream& operator<<: ``` cpp if (obj.getDatabase()->isSchema(db_schema_add_pitchDiag)) { stream << obj._pitchDiag; } ```
6* Diff new fields dbTechLayer.cpp In the method void _dbTechLayer::differences: ``` cpp DIFF_FIELD(_pitchDiag); ```
7* Diff Out new fields dbTechLayer.cpp In the method void _dbTechLayer::out: ``` cpp DIFF_OUT_FIELD(_pitchDiag); ```
8* Created access APIs to the fields dbTechLayer.cpp ``` cpp int dbTechLayer::getPitchDiag() {...} void dbTechLayer::setPitchDiag( int pitch ) {...} ```
9* Add new APIs include/db.h In the class dbTechLayer ``` cpp int getPitchDiag(); void setPitchDiag( int pitch ); ```