db: introduce support for flags