sync JavaScript enums with PostgreSQL
In our PostgreSQL database, we use enums for meter types. We also supply logical names for these types as an enum in the Meter class. These two enums need to be kept in sync, i.e. if we make changes to either one these enums in the future, we need to remember to change the other.
Hello! Can I create a folder named "shared" which contains meterTypes.js and meterTypes.ts, which can export the type nums. Then I import one in src/client/app/types/redux/meters.ts , and import another in src/server/models/Meter.js? Since the two meterTypes file are in one folder, poeple will probably remember to keep them in sync.
@RuxueJ Thanks for this idea. It is probably an improvement but I would like to see if there is a way to automatically keep the JS and TS in sync. If not, we could do what you suggest.
Also, this does not seme to address the direct issue of making the Postgres enums match the TS/JS ones. Any thoughts on that?