Migration file format reference

Introduction

With config v2, the migrations files are pure SQL files.

Migration filename format

Each migration file has the following format:

<version>_<name>.{up|down}.sql

A version which is the Unix timestamp in nanoseconds when the file was created is the first part. Followed by a name which is either manually added or auto-generated by the console. The next part indicates what step this is. If it is up, it means that this is the forward step, e.g. creating a table. The down indicates that it is the corresponding rollback step.

Migration file format

A migration SQL file can contain SQL statements which are executed on the apply step of the migration. There can be an up migration and a down migration file.