tree: 1c8897463bf9153704482f7a013b172e45fd7bdb [path history] [tgz]
  1. cockroachdb/
  2. batch-delete.sh
  3. batch-delete.sql
  4. BUILD.bazel
  5. cdb.sql
  6. README.md
  7. test.sql
perf/migrations/README.md

SQL Migrations

Pref can use SQL backends to store both trace data and other data like shortcuts and alerts. We need to have a system in place that allows changing the schema of the database and also upgrading an existing database to the schema that the version of Perf expects. To do that we use the github.com/golang-migrate/migrate/v4 library.

Each directory below here represents a supported SQL dialect. Note that the directory names should match the values of sql.Dialect. Each directory contains a series of SQL files that migrate the database schema from one version to the next. The version number is the 0-padded prefix of each file. Also note that there is both an .up. and .down. version of each migration, so we can smoothly migrate in both directions. There are also tests that ensure that the migrations work in both directions.