# Migration

Generate a migration that alters a collection that already exists. Use this to add, remove or rename fields after the collection has been generated.

### Syntax

```
$ vela generate migration <collection> <op> [args...]
```

```
$ vela generate migration pets add birthday:date
```

The collection has to exist already — Vela reads its current fields to work out the change. Run [`vela migrate up`](/migrate/up) to apply the generated migration.

### Operations

- `add` - Add one or more fields
- `remove` - Remove one or more fields
- `rename` - Rename a field
- `references` - Add a relation to another collection

### Examples

```
$ vela generate migration pets add birthday:date weight:number
$ vela generate migration pets remove weight
$ vela generate migration pets rename birthday born_on
$ vela generate migration pets references owner:user
```

Field definitions use the same [field syntax](/generate) as the other generators. For a blank migration to write by hand, use [`vela migrate create`](/migrate/create).