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/databases
folder - If applicable add this new data source to the development docker instance for local testing
- Add the new
Enum
to theDatabaseType
object insidesrc/types/database.types.ts
with the name of the new data source - Add the ability to detect the database type from the
DATABASE_URI
in thegetDatabaseType()
function atsrc/helpers/Database.ts
- 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. - Register the new injectable as a
provider
andexport
in theapp.module.ts
- Add the new switch case to each function inside
src/helpers/Query.ts
to 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:datasource
topackage.json
and toscripts/test.sh
file 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: