clickhouse-migrations 0.1.10 → 0.1.11

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
@@ -11,11 +11,13 @@ npm install --global clickhouse-migrations
11
11
 
12
12
  ## Usage
13
13
 
14
- Create a directory, where migrations will be stored. It will be used as the value for the `--migrations-home` option.
14
+ Create a directory, where migrations will be stored. It will be used as the value for the `--migrations-home` option (or for environment variable `CH_MIGRATIONS_HOME`).
15
15
 
16
- In the directory, create migrations files - which should be named like: `1_`some_text`.sql`, `2_`other_text`.sql`, ... `10_`more_test`.sql`. What is important here: migration versions followed by underscore - `1_`, `2_`, ...`10_`..., and file extension `.sql`. Any text can follow by version number. The version number should increase for every next migration.
16
+ In the directory, create migration files, which should be named like this: `1_some_text.sql`, `2_other_text.sql`, `10_more_test.sql`. What's important here is that the migration version number should come first, followed by an underscore (`_`), and then any text can follow. The version number should increase for every next migration. Please note that once a migration file has been applied to the database, it cannot be modified or removed.
17
17
 
18
- For migrations' content should be used correct SQL ClickHouse queries. A few queries can be used in one migration file. Every query should end with `;`. The queries could be idempotent - for example: `CREATE TABLE IF NOT EXISTS table ...;` For adding comments should be used `--`, `# `, `#!` at the beginning of the line. Can be used ClickHouse settings - that can be applied on query level, in the format: `SET allow_experimental_object_type = 1;` A migration file can't be changed or removed after applying.
18
+ For migrations' content should be used correct SQL ClickHouse queries. Multiple queries can be used in a single migration file, and each query should be terminated with a semicolon (;). The queries could be idempotent - for example: `CREATE TABLE IF NOT EXISTS table ...;` Clickhouse settings, that can be included at the query level, can be added like `SET allow_experimental_object_type = 1;`. For adding comments should be used `--`, `# `, `#!` at the beginning of the line.
19
+
20
+ If the database provided in the `--db` option (or in `CH_MIGRATIONS_DB`) doesn't exist, it will be created automatically.
19
21
 
20
22
  ```
21
23
  Usage
@@ -43,13 +45,15 @@ For migrations' content should be used correct SQL ClickHouse queries. A few que
43
45
  --migrations-home=/app/clickhouse/migrations
44
46
 
45
47
  clickhouse-migrations migrate
46
-
47
- Migration file example (could be named 'init-1.sql' and stored in the
48
- directory provided in --migrations-home)
48
+ ```
49
+
50
+ Migration file example:
51
+ ```
52
+ -- an example of migration file 1_init.sql
49
53
 
50
- SET allow_experimental_object_type = 1;
54
+ SET allow_experimental_object_type = 1;
51
55
 
52
- CREATE TABLE IF NOT EXISTS events (
53
- event JSON
54
- );
56
+ CREATE TABLE IF NOT EXISTS events (
57
+ event JSON
58
+ );
55
59
  ```
package/lib/migrate.js CHANGED
@@ -300,7 +300,7 @@ var migration = function (migrations_home, host, username, password, db_name) {
300
300
  exports.migration = migration;
301
301
  var migrate = function () {
302
302
  var program = new commander_1.Command();
303
- program.name('clickhouse-migrations').description('ClickHouse migrations.').version('0.1.10');
303
+ program.name('clickhouse-migrations').description('ClickHouse migrations.').version('0.1.11');
304
304
  program
305
305
  .command('migrate')
306
306
  .description('Apply migrations.')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickhouse-migrations",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "ClickHouse Migrations",
5
5
  "bin": {
6
6
  "clickhouse-migrations": "lib/cli.js"