Skip to content

Commit aa85233

Browse files
authored
Merge pull request #13 from KoalaBotUK/feature/dsql
DSQL Migration
2 parents 7323d2b + ec89710 commit aa85233

36 files changed

+1815
-907
lines changed

.github/workflows/api-deploy.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,13 @@ jobs:
4343
- name: Build
4444
run: cargo lambda build --release --output-format zip
4545

46+
- name: Migrate Database
47+
env:
48+
DSQL_ENDPOINT: ${{ secrets.DSQL_ENDPOINT }}
49+
run: |
50+
token=$(aws dsql generate-db-connect-admin-auth-token --hostname $DSQL_ENDPOINT)
51+
encoded_token=$(echo "$token" | jq -Rr @uri)
52+
sqlx migrate run --database-url 'postgresql://admin:${encoded_token}@${DSQL_ENDPOINT}/postgres?sslmode=require'
53+
4654
- name: Upload to Lambda
4755
run: aws lambda update-function-code --function-name kb2-lambda-function-${{ github.ref == 'refs/heads/main' && 'dev' || 'prod' }} --zip-file fileb://target/lambda/api/bootstrap.zip

0 commit comments

Comments
 (0)