Created
November 8, 2024 21:07
-
-
Save gajus/a06d0a088d66b98a0fe7c2b3b7a42909 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const prompt = multiline` | |
Convert all underscore-containing column names in \`SELECT\` expressions of \`SELECT\` statements to camelCase by adding aliases. | |
- Use PostgreSQL compatible syntax. | |
- Only update top-level SELECT statements and their column references. | |
- Only update queries defined using sql.unsafe\`\` or sql.type()\`\`. | |
- Only update columns that contain underscores (e.g. \`sp1.llm_generated_title\`). | |
**Example**: \`SELECT sp1.llm_generated_title\` becomes \`SELECT sp1.llm_generated_title "llmGeneratedTitle"\`. | |
- If a column already has an alias and the alias contains an underscore (e.g. \`SELECT sp1.llm_generated_title generated_title\`), change it to camelCase. | |
**Example**: \`SELECT sp1.llm_generated_title generated_title\` becomes \`SELECT sp1.llm_generated_title "generatedTitle"\`. | |
- If a function does not have an alias, use camelCase for the function name. | |
**Example**: \`SELECT add_contra_money(('CAD', 100.11)::contra_money, ('CAD', 200.22)::contra_money)\` must be aliased as "addContraMoney". | |
- If there is an existing alias, do not change it beyond converting it to camelCase as needed. | |
**Example**: \`SELECT ppp.paid_project_stripe_payment_intent_id id\` this should stay untouched. | |
- Do not rename existing aliases. | |
**Example**: \`SELECT auto_rating "rating"\` should stay as rating. | |
- Ignore queries that are invoked using \`oneFirst\`, \`anyFirst\` or \`manyFirst\`. | |
`; | |
for (const file of files) { | |
await $`aider --verbose --map-tokens 0 --no-git --no-auto-lint --no-auto-test --no-analytics --no-gui --sonnet --no-gui --no-auto-commits --yes --anthropic-api-key ${ANTHROPIC_API_KEY} $file} --message ${prompt}`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment