Metadata-Version: 2.1
Name: py-clickhouse-migrator
Version: 0.3
Summary: Simple tool for manage ClickHouse migrations.
Author: Maksim Burtsev
Author-email: zadrot-lol@list.ru
License: MIT
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENCE.txt
Requires-Dist: click>=8.0.1
Requires-Dist: clickhouse-driver>=0.2.0
Requires-Dist: python-dotenv>=1.0.0

# PyClickHouseMigrate

PyClickHouseMigrate is simple tool for manage your ClickHouse migrations.

Inspired by [dbmate](https://github.com/amacneil/dbmate) and [aerich](https://github.com/tortoise/aerich).


## Install

```sh
➜ pip install py-clickhouse-migrator
```

## Usage

### Init migrations directory.

By default migrator will create and use `./db/migrations`.

```sh
➜ migrator --url=clickhouse://default@127.0.0.1:9000/default init
```

As you can see ClickHouse url passed with `--url` param.

If you want to change migrations path then you can use `--path` parameter.

```sh
➜ migrator --path=./your_path/migrations  --url=clickhouse://default@127.0.0.1:9000/default init
```

After initializitaion make sure you the folders will created.

```sh
➜ tree db

db
├── migrations
└── schema.sql
```

### Create new migration

For creation new migrations you need `new` command.

```sh
➜  migrator --url=...  new first_migration

Migration ./db/migrations/202401080000_first_migration.py has been created.
```

And after this you can find empty migration inside db directory:
```sh
➜ tree db
db
├── migrations
│   └── 202401080000_first_migration.py
└── schema.sql
```


## Apply new migration
...

## Rollback
...

## Show command
...

## Actual schema of database
...
