Skip to content

Commit

Permalink
DAT-17582 Liquibase NPM default connection- edit summary Liquibase NP…
Browse files Browse the repository at this point in the history
…M default connection (#104)

* ♻️ (liquibase.ts): Remove legacy code for merging default config with user provided config to simplify and improve code readability.

* ♻️ (liquibase.ts): remove unused import POSTGRESQL_DEFAULT_CONFIG to clean up code and improve maintainability

* 📝 (README.md): update Liquibase configuration to use a specific changeLogFile path instead of the default configuration path
  • Loading branch information
jandroav authored Jun 20, 2024
1 parent 8ca991c commit f5a73d0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,10 @@ node-liquibase /Users/me/path/to/my/executable/for/liquibase
import {
LiquibaseConfig,
Liquibase,
POSTGRESQL_DEFAULT_CONFIG,
} from 'liquibase';

const myConfig: LiquibaseConfig = {
...POSTGRESQL_DEFAULT_CONFIG,
changeLogFile: './changelog.xml',
url: 'jdbc:postgresql://localhost:5432/node_liquibase_testing',
username: 'yourusername',
password: 'yoursecurepassword',
Expand All @@ -134,10 +133,8 @@ doEet();

```js
const Liquibase = require('liquibase').Liquibase;
const POSTGRESQL_DEFAULT_CONFIG = require('liquibase').POSTGRESQL_DEFAULT_CONFIG;

const myConfig = {
...POSTGRESQL_DEFAULT_CONFIG,
changeLogFile: './changelog.xml',
url: 'jdbc:postgresql://localhost:5432/node_liquibase_testing',
username: 'yourusername',
Expand Down Expand Up @@ -242,7 +239,6 @@ Using the `liquibase` property on your config object.
import { Liquibase, LiquibaseConfig, POSTGRESQL_DEFAULT_CONFIG } from 'liquibase';

const myConfig: LiquibaseConfig = {
...POSTGRESQL_DEFAULT_CONFIG,
changeLogFile: './changelog.xml',
url: 'jdbc:postgresql://localhost:5432/node_liquibase_testing',
username: 'yourusername',
Expand All @@ -258,7 +254,6 @@ inst.status();
import { Liquibase, LiquibaseConfig, POSTGRESQL_DEFAULT_CONFIG } from 'liquibase';

const myConfig: LiquibaseConfig = {
...POSTGRESQL_DEFAULT_CONFIG,
changeLogFile: './changelog.xml',
url: 'jdbc:postgresql://localhost:5432/node_liquibase_testing',
username: 'yourusername',
Expand Down
16 changes: 0 additions & 16 deletions src/liquibase.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env node
// import { join } from 'path';
import { CommandHandler, FileHelper } from './util';
import { POSTGRESQL_DEFAULT_CONFIG } from './constants/defaults/postgresql-default.config';
import { LiquibaseCommands } from './enums/liquibase-commands.enum';
import {
LiquibaseConfig,
Expand Down Expand Up @@ -90,7 +89,6 @@ export class Liquibase {
* ```
*/
constructor(private config: LiquibaseConfig) {
this.mergeConfigWithDefaults(config);
this.commandHandler = new CommandHandler(this.config);
}

Expand Down Expand Up @@ -922,20 +920,6 @@ export class Liquibase {
return this.commandHandler.spawnChildProcess(commandString);
}

/**
* For now, we will assume Postgres is the 'default' database type.
* In the future we can be smarter about how we merge these configs.
*
* @param config User Provided `LiquibaseConfig`
*/
private mergeConfigWithDefaults(config: LiquibaseConfig) {
const defaults: LiquibaseConfig = {
...POSTGRESQL_DEFAULT_CONFIG,
liquibase: FileHelper.bundledLiquibasePath,
};
this.config = Object.assign({}, defaults, config);
}

/**
* LEGACY CODE END
**/
Expand Down

0 comments on commit f5a73d0

Please sign in to comment.