Skip to content

Commit

Permalink
docs: update migration documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
GoranBrkuljan committed Dec 28, 2024
1 parent fcf11fa commit b74a84a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
21 changes: 11 additions & 10 deletions charybdis-migrate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,17 @@ migrate --hosts <host> --keyspace <your_keyspace> --drop-and-replace (optional)
Model dropping is not added. If you removed model, you need to drop table manually.

* ### Running migration

⚠️ If you are working with **existing** datasets, before running migration you need to make sure
that your **model
**
definitions structure matches the database in respect to table names, column names, column types,
partition keys,
clustering keys and secondary indexes so you don't alter structure accidentally.
If structure is matched, it will not run any migrations. As mentioned above,
in case there is no model definition for table, it will **not** drop it. In future,
we will add `modelize` command that will generate `src/models` files from existing data source.
* ⚠️ Always run migrations from desired directories ('src' or 'test'), to avoid scanning
'target' or other large directories.

* ⚠️ If you are working with **existing** datasets, before running migration you need to make
sure
that your **model** definitions structure matches the database in respect to table names,
column names, column types, partition keys, clustering keys and secondary indexes so you
don't alter structure accidentally. If structure is matched, it will not run any migrations.
As mentioned above, in case there is no model definition for table, it will **not** drop it.
In future, we will add `modelize` command that will generate `src/models` files from existing
data source.

* ### Global secondary indexes
If we have model:
Expand Down
31 changes: 16 additions & 15 deletions charybdis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,21 +188,22 @@ Resulting auto-generated migration query will be:
Model dropping is not added. If you removed model, you need to drop table manually.

* ### Running migration
```bash
cargo install charybdis-migrate

migrate --hosts <host> --keyspace <your_keyspace> --drop-and-replace (optional)
```

⚠️ If you are working with **existing** datasets, before running migration you need to make sure
that your **model
**
definitions structure matches the database in respect to table names, column names, column types,
partition keys,
clustering keys and secondary indexes so you don't alter structure accidentally.
If structure is matched, it will not run any migrations. As mentioned above,
in case there is no model definition for table, it will **not** drop it. In future,
we will add `modelize` command that will generate `src/models` files from existing data source.
```bash
cargo install charybdis-migrate

migrate --hosts <host> --keyspace <your_keyspace> --drop-and-replace (optional)
```
* ⚠️ Always run migrations from desired directories ('src' or 'test'), to avoid scanning
'target' or other large directories.

* ⚠️ If you are working with **existing** datasets, before running migration you need to make
sure
that your **model** definitions structure matches the database in respect to table names,
column names, column types,partition keys,clustering keys and secondary indexes so you don't
alter structure accidentally. If structure is matched, it will not run any migrations. As
mentioned above, in case there is no model definition for table, it will **not** drop it. In
future, we will add `modelize` command that will generate `src/models` files from existing
data source.

* ### Programmatically running migrations
Within testing or development environment, we can trigger migrations programmatically:
Expand Down

0 comments on commit b74a84a

Please sign in to comment.