This was originally written for a Remix app, but you could adapt it to work for any SSR framework.
Check the docs for these packages to learn how to use these snippets
https://www.npmjs.com/package/kysely-migration-cli https://www.npmjs.com/package/kysely-codegen https://www.npmjs.com/package/kysely#migrations
It's configured to use MySQL on Planetscale, but you could adjust it to use Postgres or SQLite if you want.
Basic usage:
npm run db:migrate create migrationName
Then write your migration in the file based on Kysely's recommendations.
npm run db:migrate up
If you need to go back and adjust your migration, run
npm run db:migrate down
And then make sure you run this to get your Type definitions up to date
npm run db:build
You might need to open the kysely-codegen/DB
file to get VSCode to recognize the changes. Or you could manually trigger the types to refresh.