-
Notifications
You must be signed in to change notification settings - Fork 4
How to write a migration
Pere Urbón edited this page Aug 14, 2019
·
1 revision
The tool currently supports migration changes written in yaml format. You can see a few examples of the required format in this page.
As of current version is required the first line of the migration contains the type:
- type: schema-registry for changes happening to the Confluent Schema Registry
- type: broker for changes directly to an Apache Kafka cluster
type: schema-registry
action: register
data: "{\"schema\": \"{\\\"type\\\": \\\"string\\\"}\"}"
subject: "Kafka-key2"
type: schema-registry
action: delete
id: latest
subject: "Kafka-key2"
or
type: schema-registry
action: delete
id: 3
subject: "Kafka-key2"
type: schema-registry
action: set_top_level_compatibility
data: "{\"compatibility\":\"NONE\"}"
type: broker
action: create-topic
topic: foo
config:
numPartitions: 1
replicationFactor: 1
type: broker
action: delete-topic
topic: foo
In the feature, this will change, but as of the current version the migrations are stored in the local file system. You will need to place them in a shared directory that the tool will use to read and apply them in order.
The recommend way to name the file is: [timestamp]_migration-name.yml
The tool will read the files in chronological order, from this the need of having the timestamp first to keep the changes in order.