Skip to content

Commit 67c8570

Browse files
Update Docs to symb 0.0.25 (#29)
1 parent 2991f7d commit 67c8570

File tree

7 files changed

+418
-101
lines changed

7 files changed

+418
-101
lines changed

docs/overview/cli.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
sidebar_position: 10
3+
---
4+
5+
# CLI
6+
7+
_Symb_ has a separate package to it's CLI, so the core package can be more lightweight and encapsulated.
8+
9+
The CLI is very useful to generate migrations and entities automatically.
10+
11+
## Installation
12+
13+
Migrations are created or generated using the `@techmmunity/symbiosis-cli` package, so first of all, we need to install the package.
14+
15+
```sh
16+
yarn add -D @techmmunity/symbiosis-cli
17+
```
18+
19+
## Preparation
20+
21+
Add a alias to the `symb` command.
22+
23+
```json
24+
// package.json
25+
26+
{
27+
//...
28+
"scripts": {
29+
//...
30+
"symb": "symb"
31+
}
32+
}
33+
```
34+
35+
Create a `symbiosis.config.js` file in the root dir of your app, or generate one using the [`gen:config`](#genconfig) command.
36+
37+
```js
38+
module.exports = {
39+
migrationsDir: "migrations/dir",
40+
entitiesDir: ["entities/**/dir/*.ts"],
41+
databaseConfig: {
42+
// ...
43+
},
44+
};
45+
```
46+
47+
## Commands
48+
49+
### `gen:config`
50+
51+
Automatically generates a config file at the root dir of your app.
52+
53+
The options of `symbiosis.config.js` are the same of the [`Connection`](./connections#options) class.
54+
55+
```sh
56+
yarn symb gen:config
57+
```
58+
59+
### `gen:migration`
60+
61+
This command will generate all migrations to update you database according to your code.
62+
63+
To use this command, you need to create a `symbiosis.config.js` file. You you don't have one, you can generate a empty one using the [`gen:config`](#genconfig) command.
64+
65+
```sh
66+
yarn symb gen:migration
67+
```
68+
69+
### `create:migration`
70+
71+
Create an empty migration, so you can write the migration by your own.
72+
73+
```sh
74+
yarn symb create:migration
75+
```

0 commit comments

Comments
 (0)