Chronovoyage Documentation Help

Tutorial

Initialize

First, you should name and initialize a directory.

chronovoyage init my-project --vendor mariadb cd my-project

Edit config.json.

{ "$schema": "https://raw.githubusercontent.com/fairy-select/chronovoyage/main/schema/config.schema.json", "vendor": "mariadb", "connection_info": { "host": "127.0.0.1", "port": 3306, "user": "mariadb", "password": "password", "database": "test" } }

Create migration template directory.

chronovoyage add ddl initial_migration
chronovoyage add dml initial_migration

Write sql

Write "up" sql to go.sql, and "rollback" sql to return.sql.

  • initial_migration/go.sql

CREATE TABLE category ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50) NOT NULL );
  • initial_migration/return.sql

DROP TABLE category;

Migrate

chronovoyage migrate
Last modified: 20 October 2024