From 698647861eb0dbe072b696b8fdc5312dd787e2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartholom=C3=A9=20Gili?= Date: Tue, 22 Nov 2022 09:11:48 +0100 Subject: [PATCH] fix(docs/bot): `database` config for typescript bump to `4.9.3` ref: https://github.com/barthofu/tscord/issues/96 --- docs/bot/features/database/configuration.mdx | 35 +++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/docs/bot/features/database/configuration.mdx b/docs/bot/features/database/configuration.mdx index 5b30ab5..263282a 100644 --- a/docs/bot/features/database/configuration.mdx +++ b/docs/bot/features/database/configuration.mdx @@ -22,21 +22,17 @@ Plus, SQLite is the only database supported by the **[automatic backup system](/ You can configure all of this in the `src/config/database.ts` file. -Indeed, this file exports a `databaseType` and a `mikroOrmConfig` constant, which contains a production configuration and an optional development configuration. At runtime, the good configuration is chosen thanks to the NODE_ENV environment variable. -The database type should be explicitely set in the `databaseType` constant as it will be used to determine which entity manager type Mikro-ORM should use internaly. +Indeed, this file exports a a `mikroOrmConfig` constant, which contains a production configuration and an optional development configuration. At runtime, the good configuration is chosen thanks to the NODE_ENV environment variable. +The database type should be explicitely set in the `mikroOrmConfig.production.type` constant as it will be used to determine which entity manager type Mikro-ORM should use internaly. You can find here the configuration for the different types of databases: -```ts title=databaseType -export const databaseType = 'better-sqlite' as const // (or 'sqlite') -``` - ```ts title=mikroOrmConfig { - type: databaseType, + type: 'better-sqlite', // or 'sqlite' dbName: `${databaseConfig.path}db.sqlite`, // path to the db .sqlite file } ``` @@ -44,13 +40,9 @@ export const databaseType = 'better-sqlite' as const // (or 'sqlite') -```ts title=databaseType -export const databaseType = 'postgresql' as const -``` - ```ts title=mikroOrmConfig { - type: databaseType, + type: 'postgres', dbName: process.env['DATABASE_NAME'], host: process.env['DATABASE_HOST'], port: 5432, @@ -62,10 +54,6 @@ export const databaseType = 'postgresql' as const -```ts title=databaseType -export const databaseType = 'mysql' as const -``` - ```ts title=mikroOrmConfig { type: 'mysql', @@ -80,10 +68,6 @@ export const databaseType = 'mysql' as const -```ts title=databaseType -export const databaseType = 'mariadb' as const -``` - ```ts title=mikroOrmConfig { type: 'mariadb', @@ -95,6 +79,17 @@ export const databaseType = 'mariadb' as const } ``` + + + + +```ts title=mikroOrmConfig +{ + type: 'mongo', + clientUrl: process.env['DATABASE_HOST'], +} +``` +