From 62e4a47b7a0265187b5e5ad5bba0586a36e3e93c Mon Sep 17 00:00:00 2001 From: Artur Sudnik-Hrynkiewicz Date: Mon, 9 Jan 2023 12:27:12 +0100 Subject: [PATCH] chore: renaming env variable `DB_SYNCHRONIZE` -> `DB_SYNC_SCHEMA_ON_START` --- README.md | 4 ++-- apps/vc-api/.env.example | 2 +- apps/vc-api/src/config/db.ts | 4 ++-- apps/vc-api/src/config/env-vars-validation-schema.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1e874dd3..cd238ccf 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,7 @@ The following settings are reccomended on production. These are also default app # below, if set to `true`, erases all data on every application start DB_DROP_ON_START=false # below is intended to be set to `true` only when developing locally -DB_SYNCHRONIZE=false +DB_SYNC_SCHEMA_ON_START=false ``` Execution of the database schema migrations is automated, so that only required migrations are executed to upgrade the @@ -222,7 +222,7 @@ $ npm run migration:run The reccommended settings for development are: ```dotenv DB_DROP_ON_START=true -DB_SYNCHRONIZE=true +DB_SYNC_SCHEMA_ON_START=true DB_RUN_MIGRATIONS=true ``` diff --git a/apps/vc-api/.env.example b/apps/vc-api/.env.example index cd0341cb..d1efab5b 100644 --- a/apps/vc-api/.env.example +++ b/apps/vc-api/.env.example @@ -12,5 +12,5 @@ POSTGRES_DB_NAME=vc-api #for DB_TYPE=POSTGRES or DB_TYPE=SQLITE DB_DROP_ON_START=false -DB_SYNCHRONIZE=false +DB_SYNC_SCHEMA_ON_START=false DB_RUN_MIGRATIONS=true diff --git a/apps/vc-api/src/config/db.ts b/apps/vc-api/src/config/db.ts index 496baffe..d098f273 100644 --- a/apps/vc-api/src/config/db.ts +++ b/apps/vc-api/src/config/db.ts @@ -58,7 +58,7 @@ export const typeOrmConfigFactory = (config: ConfigService): TypeOrmModuleOption type: 'better-sqlite3', database: databaseFilePath, dropSchema: config.get('DB_DROP_ON_START'), - synchronize: config.get('DB_SYNCHRONIZE'), + synchronize: config.get('DB_SYNC_SCHEMA_ON_START'), migrationsRun: config.get('DB_RUN_MIGRATIONS'), migrations: [`${path.resolve(__dirname, '../migrations/sqlite')}/*.{ts,js}`], ...commonOptions @@ -74,7 +74,7 @@ export const typeOrmConfigFactory = (config: ConfigService): TypeOrmModuleOption password: config.get('POSTGRES_DB_PASSWORD'), database: config.get('POSTGRES_DB_NAME'), dropSchema: config.get('DB_DROP_ON_START'), - synchronize: config.get('DB_SYNCHRONIZE'), + synchronize: config.get('DB_SYNC_SCHEMA_ON_START'), migrationsRun: config.get('DB_RUN_MIGRATIONS'), migrations: [`${path.resolve(__dirname, '../migrations/pg')}/*.{ts,js}`], ...commonOptions diff --git a/apps/vc-api/src/config/env-vars-validation-schema.ts b/apps/vc-api/src/config/env-vars-validation-schema.ts index 73914689..c1332e90 100644 --- a/apps/vc-api/src/config/env-vars-validation-schema.ts +++ b/apps/vc-api/src/config/env-vars-validation-schema.ts @@ -50,7 +50,7 @@ export const envVarsValidationSchema = Joi.object({ is: Joi.required().valid(DB_TYPES.SQLITE, DB_TYPES.POSTGRES), then: { DB_DROP_ON_START: Joi.boolean().default(false), - DB_SYNCHRONIZE: Joi.boolean().default(false), + DB_SYNC_SCHEMA_ON_START: Joi.boolean().default(false), DB_RUN_MIGRATIONS: Joi.boolean().default(true) } });