Skip to content

Conversation

@samirsilwal
Copy link
Collaborator

@samirsilwal samirsilwal commented Jul 17, 2024

Changes

  • Introduce new command run-script
  • Accepts --file as 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 main is 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
@samirsilwal samirsilwal self-assigned this Jul 17, 2024
@samirsilwal samirsilwal force-pushed the feat/manual-scripts branch from 475247b to 9893665 Compare July 18, 2024 06:52
@samirsilwal samirsilwal marked this pull request as ready for review July 18, 2024 07:20
*/
export async function runScriptAPI(config: Configuration, conn: DatabaseConnections, options?: RunScriptParams) {
log('Run Script');
const scriptPath = getManualScriptPath(config);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not name things as manual here. Just getScriptPath should be good.

@mesaugat mesaugat marked this pull request as draft July 30, 2024 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants