mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
* Add test for findAllWorkspaceAndInstances
The test is currently failing with a missing database error. I think
this is a problem with the test database setup rather than the specific
test
* Resolve failing test
Turns out that TypeORM column names are case sensitive when used for
ordering. The error message is terrible
Cannot read property 'databaseName' of undefined
In this case we used contextUrl and it should have been contextURL.
While column names in mysql are case insensitive I also fixed one other
occurrence of contextUrl even though it is not necessary; but using the
column names makes it easier to find when searching for references etc.
* Add a launch configuration for db-test
* Add more assertions to the test
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;