docs: document links sync command (#8212)
* docs: document links sync command * small wording fix * sentence fix
This commit is contained in:
@@ -60,14 +60,16 @@ The `defineLink` function accepts as parameters the link configurations of each
|
||||
|
||||
In this example, you define a module link between the `hello` module's `MyCustom` data model and the Product Module's `Product` data model.
|
||||
|
||||
### 2. Run Migrations
|
||||
### 2. Sync Links
|
||||
|
||||
Medusa stores links as pivot tables in the database, so you must run migrations after defining a link:
|
||||
Medusa stores links as pivot tables in the database. So, to reflect your link in the database, run the `links sync` command:
|
||||
|
||||
```bash
|
||||
npx medusa migrations run
|
||||
npx medusa links sync
|
||||
```
|
||||
|
||||
Use this command whenever you make changes to your links. For example, run this command if you remove your link definition file.
|
||||
|
||||
---
|
||||
|
||||
## Define a List Link
|
||||
|
||||
@@ -415,68 +415,36 @@ npx medusa migrations generate <module_names...>
|
||||
</Table.Body>
|
||||
</Table>
|
||||
|
||||
### seed
|
||||
### links
|
||||
|
||||
Runs latest migrations and populates the database with data from a provided JSON file.
|
||||
Manage module links in the database.
|
||||
|
||||
```bash
|
||||
npx medusa seed --seed-file=<file_path>
|
||||
npx medusa links <action>
|
||||
```
|
||||
|
||||
#### Options
|
||||
#### Actions
|
||||
|
||||
The `links` command receive an action name as an argument.
|
||||
|
||||
<Table>
|
||||
<Table.Header>
|
||||
<Table.Row>
|
||||
<Table.HeaderCell>Option</Table.HeaderCell>
|
||||
<Table.HeaderCell>Name</Table.HeaderCell>
|
||||
<Table.HeaderCell>Description</Table.HeaderCell>
|
||||
<Table.HeaderCell>Required</Table.HeaderCell>
|
||||
<Table.HeaderCell>Default</Table.HeaderCell>
|
||||
</Table.Row>
|
||||
</Table.Header>
|
||||
<Table.Body>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
|
||||
`-f=<file_path>`, `--seed-file=<file_path>`
|
||||
`sync`
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Path to the file holding the data to seed.
|
||||
Add, update, or delete links based on the definitions in the `src/links` directory of your project.
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Yes
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
\-
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
|
||||
`-m=<value>`, `--migrate=<value>`
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
Whether to run migrations before seeding the database.
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
No
|
||||
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
|
||||
`true`
|
||||
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
</Table.Body>
|
||||
|
||||
@@ -208,7 +208,7 @@ This adds a list link between the `Vendor` and `Order` data models, indicating t
|
||||
|
||||
---
|
||||
|
||||
## Step 3: Generate and Run Migrations
|
||||
## Step 3: Run Migrations and Sync Links
|
||||
|
||||
To create tables for the marketplace data models in the database, start by generating the migrations for the Marketplace Module with the following command:
|
||||
|
||||
@@ -218,12 +218,18 @@ npx medusa migrations generate marketplaceModuleService
|
||||
|
||||
This generates a migration in the `src/modules/marketeplace/migrations` directory.
|
||||
|
||||
Then, to reflect the migration and the module links in the database, run the following command:
|
||||
Then, to reflect the migration in the database, run the following command:
|
||||
|
||||
```bash
|
||||
npx medusa migrations run
|
||||
```
|
||||
|
||||
Next, to reflect your links in the database, run the `links sync` command:
|
||||
|
||||
```bash
|
||||
npx medusa links sync
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Step 4: Create Vendor Admin Workflow
|
||||
|
||||
Reference in New Issue
Block a user