Configuration
Seed configuration is done in the seed.client.ts
file.
Config Location
The default location is seed.client.ts
in the root of your project.
You can also specify a custom location using the --config
flag when running the Seed CLI commands.
If you want to persist your custom location to avoid having to use --config
for every command, you can add a @snaplet/seed
field to your package.json
file.
Config Intellisense
You can use the defineConfig
helper to define your configuration. This will provide you with intellisense for the available options.
defineConfig
types are generic by default, but once you sync your Seed Client, defineConfig
becomes typed against your database schema. 🪄
Options
adapter
- Type:
() => DatabaseClient<unknown> | Promise<DatabaseClient<unknown>>
- Required
The database adapter to use.
Example:
To learn more about the available adapters, see the Adapters reference.
alias.inflection
- Type:
boolean | InflectionStrategy
- Default:
false
Apply a global renaming strategy to all tables and columns in the generated Seed Client.
When true
, a default strategy is applied:
- Model names: pluralized and camelCased.
- Scalar field names: camelCased.
- Parent field names (one to one relationships): singularized and camelCased.
- Child field names (one to many relationships): pluralized and camelCased.
- We also support prefix extraction and opposite baseName for foreign keys inspired by PostGraphile (opens in a new tab).
Example:
alias.override
- Type:
Record<string, { name?: string, fields?: Record<string, string> }>
Rename specific tables and columns in the generated Seed Client.
This option is useful for resolving renaming conflicts that can arise when using alias.inflection
.
Example:
select
- Type:
Array<string>
Exclude or include tables from the generated Seed Client. This use the glob pattern matching api (opens in a new tab)
All tables are included by default, if you prefix a table with !
everything matching that pattern will be excluded.
The patterns apply in their declaration order.
Example: