alepha@docs:~/docs/reference/primitives$
cat $seed.md | pretty1 min read
#$seed
#Import
typescript
1import { $seed } from "alepha/orm";
#Overview
Activate seed mode: a convenience wrapper around $mode that runs the handler
inside a database transaction.
When SEED=true (or MODE=SEED) is set, the owning class becomes alepha.target,
the graph is pruned, and the handler runs inside db.transactional().
After completion (or error), the app stops automatically.
Returns true if seed mode is active, false otherwise.
#Examples
ts
1import { $seed } from "alepha/orm"; 2import { $repository } from "alepha/orm"; 3 4class AppSeed { 5 users = $repository(userEntity); 6 7 seed = $seed({ 8 handler: async () => { 9 await this.users.create({ name: "John Doe" });10 },11 });12}
bash
SEED=true node app.js