Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce new command to run manual scripts #233

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants