Strata · MigrationsCross-sequence order (
Cross-sequence order (dependsOn)
dependsOn lists migrations of other sequences that must be applied before a migration runs. By default sequences run in the order they are passed, each sequence’s migrations in their own order. Here the table of theatre.door/1 references bookings, so the migration depends on theatre.app/2 and is ordered last, although its sequence is passed first.
{
id: 'theatre.door',
migrations: [
{
description: 'Who was let in',
dependsOn: ['theatre.app/2'],
steps: [
{
kind: 'sql',
sql: 'CREATE TABLE admitted (booking text PRIMARY KEY REFERENCES bookings)',
},
],
},
],
}{
id: 'theatre.app',
migrations: ['Shows', 'Bookings', 'Season passes'],
}planMigrations(await prepare([door, APP]), [])
[ 'theatre.app/1', 'theatre.app/2', 'theatre.app/3', 'theatre.door/1', ]
Runs in this page on the installed package. The input and the expected output are defined by the example.