Skip to content

feat: [ENG-3586] AI Gateway Stats page MVP #136

feat: [ENG-3586] AI Gateway Stats page MVP

feat: [ENG-3586] AI Gateway Stats page MVP #136

name: ClickHouse Migration Check
on:
pull_request:
paths:
- 'clickhouse/migrations/**'
push:
branches:
- main
paths:
- 'clickhouse/migrations/**'
jobs:
check-migrations:
name: Check Migrations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Check Migration Numbers
run: |
python - <<EOF
import os
import re
import sys
files = [f for f in os.listdir('clickhouse/migrations') if f.startswith('schema_') and f.endswith('.sql')]
if not files:
print("No migrations found")
sys.exit(1)
nums = []
for f in files:
match = re.search(r'schema_(\d+)_', f)
if match:
nums.append(int(match.group(1)))
nums.sort()
if len(nums) != len(set(nums)):
print("Found duplicate numbers")
sys.exit(1)
if list(range(min(nums), max(nums) + 1)) != nums:
print("Found gaps in numbers")
sys.exit(1)
print(f"OK - {len(nums)} migrations from {min(nums)} to {max(nums)}")
EOF