-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Is your feature request related to a problem? Please describe.
When the database schema changes, the TypeScript type definitions in each lambda function's db-types.d.ts files become out of sync. This requires manual regeneration using `kysely-codegen.
Currently, we have 4 lambda functions that each need their db-types.d.ts file updated:
apps/backend/lambdas/donors/db-types.d.tsapps/backend/lambdas/expenditures/db-types.d.tsapps/backend/lambdas/projects/db-types.d.tsapps/backend/lambdas/users/db-types.d.ts
Describe the solution you'd like
Create a GitHub Action workflow that automatically regenerates database type files whenever the database schema changes. The workflow should:
-
Trigger on pull requests when database-related files are modified:
- apps/backend/db/db_setup.sql
- apps/backend/db/kysely-codegen.config.js
-
Run
kysely-codegento generate fresh TypeScript types- Copy the generated types to each lambda function's
db-types.d.tsfile
- Copy the generated types to each lambda function's
-
Commit changes automatically
- Commit the updated type files back to the PR branch
- Include a clear commit message:
chore: auto-regenerate database types from schema changes - Co-author with the PR creator (similar to
terraform-plan.ymlworkflow, this is more optional)
-
Verify that the generated types compile correctly
- Fail the workflow if type generation fails with clear error messages
Metadata
Metadata
Assignees
Labels
No labels