feat: add Python migration script and successfully test SQLite to PostgreSQL data migration

- Created scripts/migrate-sqlite-to-postgres.py as alternative to TypeScript version
- Handles all type conversions: timestamps, booleans, and JSONB fields
- Successfully migrated all 2,836 rows from SQLite to PostgreSQL
- Verified data integrity: all 6 tables migrated correctly
- Charts: 1, Candles: 2,592, Annotations: 4, Span annotations: 223
This commit is contained in:
Marko Djordjevic 2026-02-17 14:01:21 +01:00
parent 5f70f13da3
commit bfe437857b
9 changed files with 1080 additions and 20 deletions

View file

@ -16,8 +16,8 @@ FROM node:20-alpine
WORKDIR /app
# Install build dependencies for better-sqlite3
RUN apk add --no-cache python3 make g++
# Install PostgreSQL client for pg module
RUN apk add --no-cache postgresql-client
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
@ -25,7 +25,7 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Copy node_modules for native dependencies like better-sqlite3
# Copy node_modules for dependencies
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
# Copy drizzle migrations
@ -37,7 +37,7 @@ COPY --from=builder --chown=nextjs:nodejs /app/scripts ./scripts
# Copy initial data CSV
COPY --from=builder --chown=nextjs:nodejs /app/EURUSD.csv ./EURUSD.csv
RUN mkdir -p /app/public /app/data && chown -R nextjs:nodejs /app/public /app/data
RUN mkdir -p /app/public && chown -R nextjs:nodejs /app/public
# Make startup script executable
RUN chmod +x /app/scripts/startup.sh