Create Migration

Create new SQL migration files for multiple database dialects (sqlite, mysql, etc.)

c9s Updated
bbgo dashboard

File contents

Create new migration files named $ARGUMENTS for all configured database dialects.

Run the wrapper script:

bash scripts/create-migration.sh $ARGUMENTS

If the script is not found, fall back to finding all rockhopper_*.yaml config files and running rockhopper --config <config> create --type sql $ARGUMENTS for each.

After creation, list the newly created files and remind the user to edit all migration files since each dialect may need different SQL syntax.

Migration file format reference

-- @package packagename
-- +up
CREATE TABLE example (id INT PRIMARY KEY);

-- +down
DROP TABLE example;

For multi-statement blocks, use -- +begin / -- +end. Use -- !txn to disable transaction wrapping.

c9s/bbgo commit 3325b0c87d

Frequently asked questions

npx get-skill add c9s/create-migration