Depending on the package manager you have, you can use any of the following commands.
To perform this configuration we need to install the following dependencies.
Dotenv: This a dependency module that loads environment variables.
npminstalldotenv
yarnadddotenv
Typeorm naming strategies: This package provides some useful custom naming strategies on our database columns.
npminstalltypeorm-naming-strategies
yarnaddtypeorm-naming-strategies
You need to modify the src/app.module.ts file where the connection to the database is made, where a dynamic route is added to read the entities and migrations that are added.
When you start your project, you should have your env files defined. Otherwise, by default it looks for an .env.development file to read the environment variables from, but you can change the name of this file in your configuration.
At the time this was done, some TypeORM documentation configuration was found to be outdated, and some elements of the datasource were no longer allowed. So if you have problems configuring your datasource, you can check in the TypeScript class which fields are allowed.
Now add the following scripts to your package.json file.