The Migration file format
These are the principles:
In short, migration files are pure SQL files.
Each migration file has the following format:
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.
A migration SQL file can contain SQL statements which are executed on the apply step of the migration.
The UP file contains any sql statements to be run by the apply command, you can think of this as going UP one version. The SQL can create, update, drop tables, rename resources, etc. Whatever is necessary to accomplish the NEXT version.
The DOWN file contains any SQL statements to roll back this version. It is a bit more complex because it has to change back any modifications made by UP.
For more details on the format of these files, refer to the Migration file format documentation
Hasura Migrations - The Metadata directory
The following files will be generated in the metadata/ directory of your project.
version.yaml
: Contains the metadata version of the servertables.yaml
: Contains the metadata related to tablesremote_schemas.yaml
: Contains the metadata related to remote schemasfunctions.yaml
: Contains the metadata related to custom functionsallow_list.yaml
: Contains the metadata related to allow listsactions.yaml
: Contains the metadata related to actionsactions.graphql
: Contains all the action definition and custom type definitions
For more details on the format of these files, refer to the Metadata directory format documentation
Last updated