clickhouse-migrations 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,17 +22,25 @@ For migrations' content should be used correct SQL ClickHouse queries. A few que
22
22
  $ clickhouse-migrations migrate <options>
23
23
 
24
24
  Required options
25
- --host=<name> Clickhouse hostname, in
26
- format https://clichouse
25
+ --host=<name> Clickhouse hostname (ex. https://clickhouse)
27
26
  --port=<number> Port
28
27
  --user=<name> Username
29
- --pass=<password> Password
30
- --db-name=<database> Database name
28
+ --password=<password> Password
29
+ --db=<name> Database name
31
30
  --migrations-home=<dir> Migrations' directory
32
31
 
32
+ Environment variables
33
+ Instead of options can be used environment variables.
34
+ CH_MIGRATIONS_HOST Clickhouse hostname (--host)
35
+ CH_MIGRATIONS_PORT Port (--port)
36
+ CH_MIGRATIONS_USER Username (--user)
37
+ CH_MIGRATIONS_PASSWORD Password (--password)
38
+ CH_MIGRATIONS_DB Database name (--db)
39
+ CH_MIGRATIONS_HOME Migrations' directory (--migrations-home)
40
+
33
41
  Examples
34
42
  clickhouse-migrations migrate --host=http://localhost
35
- --port=8123 --user=default --pass=''
36
- --db-name=analytics --migrations-home=/app/clickhouse/migrations
43
+ --port=8123 --user=default --password=''
44
+ --db=analytics --migrations-home=/app/clickhouse/migrations
37
45
 
38
- ```
46
+ clickhouse-migrations migrate
package/lib/migrate.js CHANGED
@@ -304,20 +304,20 @@ var migration = function (migrations_home, host, port, username, password, db_na
304
304
  }); };
305
305
  var migrate = function () {
306
306
  var program = new Command();
307
- program.name('clickhouse-migrations').description('ClickHouse migrations.').version('1.0.0');
307
+ program.name('clickhouse-migrations').description('ClickHouse migrations.').version('0.1.5');
308
308
  program
309
309
  .command('migrate')
310
- .description('apply migrations.')
311
- .requiredOption('--host <name>', 'clickhouse hostname in format http://clickhouse')
312
- .requiredOption('--port <number>', 'port')
313
- .requiredOption('--user <name>', 'username')
314
- .requiredOption('--pass <password>', 'password')
315
- .requiredOption('--db-name <dbname>', 'database name')
316
- .requiredOption('--migrations-home <dir>', 'migrations directory')
310
+ .description('Apply migrations.')
311
+ .requiredOption('--host <name>', 'Clickhouse hostname (ex. https://clickhouse)', process.env.CH_MIGRATIONS_HOST)
312
+ .requiredOption('--port <number>', 'Port', process.env.CH_MIGRATIONS_PORT)
313
+ .requiredOption('--user <name>', 'Username', process.env.CH_MIGRATIONS_USER)
314
+ .requiredOption('--password <password>', 'Password', process.env.CH_MIGRATIONS_PASSWORD)
315
+ .requiredOption('--db <name>', 'Database name', process.env.CH_MIGRATIONS_DB)
316
+ .requiredOption('--migrations-home <dir>', "Migrations' directory", process.env.CH_MIGRATIONS_HOME)
317
317
  .action(function (options) { return __awaiter(void 0, void 0, void 0, function () {
318
318
  return __generator(this, function (_a) {
319
319
  switch (_a.label) {
320
- case 0: return [4 /*yield*/, migration(options.migrationsHome, options.host, options.port, options.user, options.pass, options.dbName)];
320
+ case 0: return [4 /*yield*/, migration(options.migrationsHome, options.host, options.port, options.user, options.password, options.db)];
321
321
  case 1:
322
322
  _a.sent();
323
323
  return [2 /*return*/];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickhouse-migrations",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "CLI NodeJS ClickHouse Migrations",
5
5
  "bin": {
6
6
  "clickhouse-migrations": "lib/cli.js"