fix(mysql): make sure migrations are run in order when run concurrently

Now we either lock all or none of the migrations to run,
to make sure they are not out of order when multiple instances of Emigrate run concurrently.
This commit is contained in:
Joakim Carlstein 2025-04-24 15:06:32 +02:00 committed by Joakim Carlstein
parent 6eb60177c5
commit 26240f49ff
13 changed files with 922 additions and 98 deletions

View file

@ -15,6 +15,18 @@ jobs:
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
DO_NOT_TRACK: 1
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: emigrate
MYSQL_USER: emigrate
MYSQL_PASSWORD: emigrate
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- name: Check out code
uses: actions/checkout@v4
@ -26,11 +38,22 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20.9.0
node-version: 22.15.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Wait for MySQL to be ready
run: |
for i in {1..30}; do
nc -z localhost 3306 && echo "MySQL is up!" && break
echo "Waiting for MySQL..."
sleep 2
done
- name: Checks
env:
MYSQL_HOST: localhost
MYSQL_PORT: 3306
run: pnpm checks

View file

@ -30,7 +30,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20.9.0
node-version: 22.15.0
cache: 'pnpm'
- name: Install Dependencies