docs: move all plugin types under the same "Plugins" category

This commit is contained in:
Joakim Carlstein 2023-12-18 09:27:44 +01:00 committed by Joakim Carlstein
parent d5c6e9b1db
commit 99d189aeb9
12 changed files with 73 additions and 26 deletions

View file

@ -18,27 +18,39 @@ export default defineConfig({
link: '/getting-started/', link: '/getting-started/',
}, },
{ {
label: 'Storage Plugins', label: 'Plugins',
items: [ items: [
{ label: 'Introduction', link: '/storage/' }, {
{ label: 'File System', link: '/storage/file-system/' }, label: 'Introduction',
{ label: 'MySQL', link: '/storage/mysql/' }, link: '/plugins/',
},
{
label: 'Storage Plugins',
collapsed: true,
items: [
{ label: 'Introduction', link: '/plugins/storage/' },
{ label: 'File System', link: '/plugins/storage/file-system/' },
{ label: 'MySQL', link: '/plugins/storage/mysql/' },
], ],
}, },
{ {
label: 'Loader Plugins', label: 'Loader Plugins',
collapsed: true,
items: [ items: [
{ label: 'Introduction', link: '/loaders/' }, { label: 'Introduction', link: '/plugins/loaders/' },
{ label: 'Default Loader', link: '/loaders/default/' }, { label: 'Default Loader', link: '/plugins/loaders/default/' },
{ label: 'MySQL Loader', link: '/loaders/mysql/' }, { label: 'MySQL Loader', link: '/plugins/loaders/mysql/' },
], ],
}, },
{ {
label: 'Reporters', label: 'Reporters',
collapsed: true,
items: [ items: [
{ label: 'Introduction', link: '/reporters/' }, { label: 'Introduction', link: '/plugins/reporters/' },
{ label: 'Default Reporter', link: '/reporters/default/', badge: 'WIP' }, { label: 'Default Reporter', link: '/plugins/reporters/default/', badge: 'WIP' },
{ label: 'Pino Reporter', link: '/reporters/pino/', badge: 'WIP' }, { label: 'Pino Reporter', link: '/plugins/reporters/pino/', badge: 'WIP' },
],
},
], ],
}, },
{ {

View file

@ -14,7 +14,7 @@ Emigrate is written in [TypeScript](https://www.typescriptlang.org) and is a dat
* The output can be customized using [Reporters](/reporters/). * The output can be customized using [Reporters](/reporters/).
:::tip[Did you know?] :::tip[Did you know?]
Thanks to the plugin system you can even write migrations in plain SQL! So no need for Java-based tools like Liquibase or Flyway. Thanks to [the plugin system](/plugins/) you can even write migrations in plain SQL! So no need for Java-based tools like Liquibase or Flyway.
::: :::
## Quick Start ## Quick Start
@ -46,10 +46,10 @@ But for now, this is the way to go.
### Pick a storage plugin ### Pick a storage plugin
Emigrate uses a storage plugin to store the migration history. You can use one of the following plugins: Emigrate uses a [storage plugin](/plugins/storage/) to store the migration history. You can use one of the following plugins:
- [MySQL](/storage/mysql) - [MySQL](/plugins/storage/mysql)
- [File System](/storage/file-system) - [File System](/plugins/storage/file-system)
Install the plugin you want to use, for example: Install the plugin you want to use, for example:
@ -95,7 +95,7 @@ Otherwise the file would have the `.js` extension by default.
:::tip[Did you know?] :::tip[Did you know?]
You can avoid typing `--plugin mysql` by configuring Emigrate using an `emigrate.config.js` file. You can avoid typing `--plugin mysql` by configuring Emigrate using an `emigrate.config.js` file.
See [Configuration](/configuration) for more information. See [Configuration](/configuration/) for more information.
::: :::
#### Fill the migration file #### Fill the migration file

View file

@ -0,0 +1,35 @@
---
title: The Plugin System
---
import { LinkCard } from '@astrojs/starlight/components';
Emigrate uses a plugin system to allow you to extend and customize the functionality so that it fits your needs.
## The types of plugins
Emigrate supports different types of plugins that all have different purposes.
<LinkCard
href="/plugins/storage/"
title="Storage Plugins"
description="The most important plugin type. A storage plugin is responsible for storing and handling the migration history state."
/>
<LinkCard
href="/plugins/loaders/"
title="Loader Plugins"
description="A loader plugin is responsible for loading migration files with a specific format and transforming them into a JavaScript function."
/>
<LinkCard
href="/plugins/reporters/"
title="Reporters"
description="A reporter is responsible for the output of the migration process. Use a different reporter if you want the output suitable for log shipping or to be machine readable."
/>
<LinkCard
href="/plugins/generators/"
title="Generator Plugins"
description="A generator plugin generates new migration files. Usually included in loader plugin packages so the same package can be used for both creating and loading migrations in a certain format."
/>

View file

@ -19,7 +19,7 @@ npx emigrate up --plugin mysql
Or set it up in your configuration file, see [Plugin configuration](/reference/configuration/#plugins) for more information. Or set it up in your configuration file, see [Plugin configuration](/reference/configuration/#plugins) for more information.
:::tip[Did you know?] :::tip[Did you know?]
You can specify multiple loader plugins at the same time, which is needed when you mix file types in your migrations. You can specify multiple loader plugins at the same time, which is needed when you mix file types in your migrations folder.
For example, you can use the `mysql` loader for `.sql` files and the `typescript` loader for `.ts` files. For example, you can use the `mysql` loader for `.sql` files and the `typescript` loader for `.ts` files.
The [default loader](/loaders/default/) will be used for all other file types, and doesn't need to be specified. The [default loader](/loaders/default/) will be used for all other file types, and doesn't need to be specified.
::: :::