#!/bin/bash
set -e
echo "Applying Migration 019: Legal Templates Attribution + 6 new templates..."
/usr/local/bin/docker exec bp-compliance-backend python3 -c "
import psycopg2, os
conn = psycopg2.connect(os.getenv('DATABASE_URL'))
cur = conn.cursor()
with open('/app/migrations/019_legal_templates_attribution.sql') as f:
    cur.execute(f.read())
conn.commit()
cur.close()
conn.close()
print('Migration 019 applied successfully')
"
echo "Done."
