Adding Data Sources

Below is a step by step guide to adding a new data source, useful for developers wanting to support a new database, data storage tool or other form of data source.

  1. Add the demo database / file in the demo/databases folder
  2. If applicable add this new data source to the development docker instance for local testing
  3. Add the new Enum to the DatabaseType object inside src/types/database.types.ts with the name of the new data source
  4. Add the ability to detect the database type from the DATABASE_URI in the getDatabaseType() function at src/helpers/Database.ts
  5. Create a new src/databases/{name}.database.ts file which handles all of the interactions with the data source. Review the other files to see which functions are needed.
  6. Register the new injectable as a provider and export in the app.module.ts
  7. Add the new switch case to each function inside src/helpers/Query.ts to wire up the new database file.
  8. Do the same for the getSchema() function inside src/helpers/Schema.ts
  9. Ensure all test pass using this data source in your .env.
  10. Add the new data source test script e.g. test:datasource to package.json and to scripts/test.sh file for automated testing
  11. Submit a PR for a review from our core team. If you have credentials to a testing environment please include them.

Here is an example pull request with an additional data source being added: