Skip to content

Commit

Permalink
chore: renaming env variable DB_SYNCHRONIZE -> `DB_SYNC_SCHEMA_ON_S…
Browse files Browse the repository at this point in the history
…TART`
  • Loading branch information
artursudnik committed Jan 17, 2023
1 parent eb18e95 commit 62e4a47
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```

Expand Down
2 changes: 1 addition & 1 deletion apps/vc-api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions apps/vc-api/src/config/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/vc-api/src/config/env-vars-validation-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
});

0 comments on commit 62e4a47

Please sign in to comment.