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.
- Add the demo database / file in the
demo/databasesfolder - If applicable add this new data source to the development docker instance for local testing
- Add the new
Enumto theDatabaseTypeobject insidesrc/types/database.types.tswith the name of the new data source - Add the ability to detect the database type from the
DATABASE_URIin thegetDatabaseType()function atsrc/helpers/Database.ts - Create a new
src/databases/{name}.database.tsfile which handles all of the interactions with the data source. Review the other files to see which functions are needed. - Register the new injectable as a
providerandexportin theapp.module.ts - Add the new switch case to each function inside
src/helpers/Query.tsto wire up the new database file. - Do the same for the
getSchema()function insidesrc/helpers/Schema.ts - Ensure all test pass using this data source in your
.env. - Add the new data source test script e.g.
test:datasourcetopackage.jsonand toscripts/test.shfile for automated testing - 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:
