Skip to content
Playground(another site)

bynk.d1.migration_name

Error A file in the project's migrations/ folder isn't migrations/<database>/NNNN_<name>.sql, or shares its number with another migration of the same database.

A D1 database's migrations are the SQL files in migrations/<database>/, applied in number order, each once. So a file's name must give its place in that order: NNNN_<name>.sql, four digits, an underscore, then letters, digits, _ or -, directly in its database's directory. A file named any other way, one in a nested folder, or one whose number another migration of the same database already has could not be put in order, so the build refuses it rather than skip it. Rename the file, or give it the next free number.

Example

migrations/shop-orders/1_create_orders.sql // ✗ not four digits
migrations/shop-orders/0002_add_note.sql
migrations/shop-orders/0002_add_total.sql // ✗ `0002` is taken
migrations/shop-orders/0001_create_orders.sql // ✓
migrations/shop-orders/0002_add_note.sql
migrations/shop-orders/0003_add_total.sql // ✓ the next free number

In the Book

See also

  • Every code in its category, Other, on the diagnostic index.
  • bynk explain bynk.d1.migration_name shows the same from the installed toolchain, without a network.