If overwriting changes you made in the generated code is an issue, you can put these changes into their own partial class files. These will not be overwritten when re-scaffolding from a changed database. As is also recommended here:
https://learn.microsoft.com/en-us/ef/core/managing-schemas/scaffolding/?tabs=vs#repeated-scaffolding