Docs / Make commands

v0.1.10 · Study guide

Make commands

Append a model to schema.tpy and regenerate only that model’s files — or refresh a single layer after a manual schema tweak.

What you will learn
  • How make:model differs from tpy build
  • Field string syntax
  • When --force is required

1. Setup

$ tpy make:model Invoice --fields "amount:float,status:enum(draft,paid),user_id:uuid references User"
$ tpy make:controller Invoice
$ tpy make:service Invoice
$ tpy migrate

2. How it works

  1. make:model parses --fields, appends a model via the shared serializer, validates, then generates only that model’s layers (model, migration, schema, repository, service, controller, routes + router index).
  2. It does not re-run a full multi-model tpy build.
  3. Generated files start with # tpy:generated:sha256:…. If you edit the file by hand, regeneration requires --force.

3. Examples

$ tpy make:model Note --fields "title:string required,body:string nullable"
$ tpy make:service Note --force

If no primary field is provided, Studio/make prepends id: uuid primary.

4. Common mistakes

  • Commas inside enums — use enum(draft,paid); the splitter respects parentheses.
  • Silent overwrite fear — without a matching marker, make refuses to overwrite unless --force.
  • Forgetting migrate — new migrations still need tpy migrate.

5. Related