rit-sse / node-api

💯 The SSE New and Improved Unified API
https://sse.rit.edu/api/v2
MIT License
8 stars 9 forks source link

Fix cascade delete quotes tags migration to await on temp table creation #116

Closed gavrielrh closed 4 years ago

gavrielrh commented 4 years ago

When running the initial bootstrap command to seed the DB, the script currently fails on running a specific migration (via umzug up).

The migration in question creates a temp table, and then renames the table, to get around the lack of DROP CONSTRAINT syntax in SQLite.

Unfortunately, the way the migration is written, it can fail depending on the execution timing of the queries.

This is because the sequence of events is wrapped in a Promise.all, which has no real guarantee of execution sequence.

This PR remedies the issue by forcing the migration to await on the temp table creation before acting on the resulting queries.