Skip to content

Sync Database Schemas #14938

Sync Database Schemas

Sync Database Schemas #14938

Workflow file for this run

name: Sync Database Schemas
on:
schedule:
- cron: "*/10 * * * *" # run every 10 minutes
jobs:
run:
runs-on: ubuntu-latest
env:
DATABASE_CONNECTION_STRING: ${{ secrets.DATABASE_CONNECTION_STRING }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Pull Schema
run: |
npm ci
npm run db:pull
npx @biomejs/biome lint --write ./database/migrations
npx @biomejs/biome format --write ./database/migrations
- name: Fix Import Paths
run: |
# Replace "./schema" with "./schema.js" (Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext')
sed -i 's|"./schema"|"./schema.js"|g' ./database/migrations/relations.ts
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
- name: Log Pull Request Info
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"