Skip to content

Commit

Permalink
Merge pull request #6 from chgk-gg/sqlite_backup
Browse files Browse the repository at this point in the history
fix db-to-sqlite setup, add schedule
  • Loading branch information
razumau authored Jan 19, 2025
2 parents b112671 + 29b2afa commit fc00ba2
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/create_sqlite_backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Create sqlite backup

on:
workflow_dispatch:
cron:
- '0 3 * * *'

jobs:
update_schema:
Expand All @@ -27,6 +29,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- run: uv tool install "db-to-sqlite[postgresql]"

- name: Install PostgreSQL 15 client
run: |
Expand All @@ -50,21 +53,32 @@ jobs:
- name: Run db-to-sqlite for public
run: |
uvx db-to-sqlite "postgresql://postgres:password@localhost:5432/postgres" \
mkdir sqlite
uvx db-to-sqlite "postgresql://postgres:password@localhost:5432/postgres" \
sqlite/${{ steps.date.outputs.yesterday }}_public.sqlite \
--all \
--postgres-schema b \
--postgres-schema public \
--progress \
--skip django_migrations --skip django_admin_log --skip django_content_type --skip django_session \
--skip ar_internal_metadata --skip auth_group_permissions --skip auth_group --skip auth_permission \
--skip auth_user --skip auth_user_groups --skip auth_user_user_permissions --skip schema_migrations \
--skip ndcg --skip models
- name: Run db-to-sqlite for b
run: |
uvx db-to-sqlite "postgresql://postgres:password@localhost:5432/postgres" \
sqlite/${{ steps.date.outputs.yesterday }}_b.sqlite \
--all \
--postgres-schema b \
--progress \
--skip django_migrations --skip team_rating_by_player --skip team_lost_heredity \
--skip player_rating_by_tournament --skip player_rating
- uses: ryand56/r2-upload-action@latest
with:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: sqlite
destination-dir: ./new
destination-dir: ./

0 comments on commit fc00ba2

Please sign in to comment.