Page MenuHomeSoftware Heritage

Add tests for SQL migrations
Closed, MigratedEdits Locked

Description

There is currently nothing to test SQL migrations scripts (sql/upgrades/*.sql) before running them in production.

At the very least, we should have automated tests that schemas are correctly upgraded (data are another, harder, issue).

@olasd and I see two possibilities:

  1. Duplicate today's schema on git, and have a test that: 1. applies it 2. applies all migrations added after today 3. compares the resulting DB with the one created from the full schema
  2. Have a CI job reading the Git history that: 1. applies the commit parent's schema 2. applies the new migration 3. compares the DBs