-
-
Save bwlng/6d7a87916236bc14cef0bda93267d621 to your computer and use it in GitHub Desktop.
Kysely migrations
This file contains 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
#!/usr/bin/env bash | |
# Ensure script stops when commands fail. | |
set -e | |
echo "Migrating database..." | |
# Ensure the dist directory exists. | |
mkdir -p ./db/dist | |
mkdir -p ./db/dist/migrations | |
# Compile the TypeScript files to JavaScript. | |
npx tsc --outDir ./db/dist ./db/*.ts --target ESNext --moduleResolution node --module ESNext --esModuleInterop true | |
npx tsc --outDir ./db/dist/migrations ./db/migrations/*.ts --target ESNext --moduleResolution node --module ESNext --esModuleInterop true | |
# Run the migrations. | |
node ./db/dist/migrate.js | |
# Remove the dist directory. | |
rm -r ./db/dist | |
echo "Migrations complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment