sync-db
sync-db copied to clipboard
Introduce new command to run manual scripts
Changes
- Introduce new command
run-script - Accepts
--fileas flag - Can be used to run manual scripts in JS/TS or SQL
- For SQl, simply run the script present in the given file
- For JS/TS, a function
mainis expected to be exported which gets knex connection and identifier as args. example
export async function main(conn: Knex.Transaction, id: string) {
await conn.......
log(`Completed script for ${id}`)
}
- Other existing flags like
--only-> to run script for specific connection and--dry-run-> to dry run the script works as usual - Update unit tests
Todo
- Update readme
- Add demo ss