# Write to Kafka topics.


## How to create a migration

- Put your migration files under `/kafka-db-deploy/kafka/build/changelog/{dml}` directory
- Only XML format is supported for migrations
- No special rollback sections/tags. To rollback a migration you will have to create a new migration with rollback messages manually.
- The changeset id must be unique across all changesets. Follow best practices below to ensure this.

## Best Practices

- Only one file per PR.
- Changeset id should match the file ('.xml' filetype excluded)
- If there are multiple changesets in a file, append the sequence number of the changeset
- Only one statement per changeset.

## Migration example

Refer [kafka_sample.xml](./build/changelog/dml/kafka_sample.xml)

- changeset.id - Required field
- changeset.author - Required field
- changeset.topic - Required field. Kafka topic name
- changeset.kafka-cluster-name - Optional. Default is `managed-kafka-cdc-destination`.
- changeset.kafkamessage.key - Optional. Key for kafka message. Default is null.
- changeset.kafkamessage.tombstone - Optional. Boolen. True if this is  tombstone message ie with null body. Default is `false`.
