0.1.1 • Published 2 years ago
test-gp-dbs v0.1.1
Gitpod-db
Contains all the database related functionality, implemented using typeorm.
Adding a new table
- Create a migration - use the baseline as an exemplar
- Create a new entity that implements the requisite interface or extend an existing entity as required - see db-user.ts
- If it is a new table, create the matching injectable ORM implementation and interface (if required) - see user-db-impl.ts and user-db.ts. Otherwise extend the existing interface and implementation as required.
- Add the injectable implementation to the DB container module, binding the interface and implementation as appropriate, otherwise it will not be instantiated correctly e.g.
bind(TypeORMUserDBImpl).toSelf().inSingletonScope();
bind(UserDB).toService(TypeORMUserDBImpl);
- Add the new ORM as an injected component where required e.g. in user-controller.ts
@inject(UserDB) protected readonly userDb: UserDB;
0.1.1
2 years ago