From 4d0983380d8ba39fd30c477755d94bbbd25c67d2 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Sat, 13 Dec 2025 21:25:43 +0000 Subject: [PATCH] migrate db --- .github/workflows/atlas-migratie-dev.yml | 34 ------------------------ .github/workflows/deploy-postgres.yml | 29 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/atlas-migratie-dev.yml diff --git a/.github/workflows/atlas-migratie-dev.yml b/.github/workflows/atlas-migratie-dev.yml deleted file mode 100644 index cc8c16f..0000000 --- a/.github/workflows/atlas-migratie-dev.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Atlas Migrate (dev) - -on: - push: - branches: - - main - -jobs: - migrate: - runs-on: mealcraft-runners - - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - # Install Atlas - - name: Install Atlas CLI - run: | - curl -sSf https://atlasgo.sh | sh - - # Load DB creds from Kubernetes secret - - name: Load Postgres credentials - run: | - export POSTGRES_USER=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_USER}' | base64 -d) - export POSTGRES_PASSWORD=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_PASSWORD}' | base64 -d) - - echo "POSTGRES_USER=$POSTGRES_USER" >> $GITHUB_ENV - echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >> $GITHUB_ENV - - # Run Atlas migrations (DEV only) - - name: Run Atlas migrations (dev) - run: | - atlas migrate apply \ - --env stripe_invoice_dev diff --git a/.github/workflows/deploy-postgres.yml b/.github/workflows/deploy-postgres.yml index 7dc7524..ba369dc 100644 --- a/.github/workflows/deploy-postgres.yml +++ b/.github/workflows/deploy-postgres.yml @@ -57,3 +57,32 @@ jobs: - name: Deploy Postgres backups run: | kubectl apply -f db/k8s/backups/ + + migrate: + runs-on: mealcraft-runners + needs: deploy + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + # Install Atlas + - name: Install Atlas CLI + run: | + curl -sSf https://atlasgo.sh | sh + + # Load DB creds from Kubernetes secret + - name: Load Postgres credentials + run: | + export POSTGRES_USER=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_USER}' | base64 -d) + export POSTGRES_PASSWORD=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_PASSWORD}' | base64 -d) + + echo "POSTGRES_USER=$POSTGRES_USER" >> $GITHUB_ENV + echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >> $GITHUB_ENV + + # Run Atlas migrations (DEV only) + - name: Run Atlas migrations (dev) + run: | + atlas migrate apply \ + --env stripe_invoice_dev + \ No newline at end of file