Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
3
pomdtr avatar

Nice val!

A pattern I like is to set the table name as the val name (see https://www.val.town/v/pomdtr/test_migrations).

pomdtr avatar

I wonder if it would make sense to be able to set the migration index as a second argument in the migrate function (defaulting to migrations.length - 1). The migrate function would then apply the up or down migrations depending on the current table state.

saolsen avatar

Nice, yeah using name as a val name is def a nice pattern.

Saying the index or how many migrations to do makes sense. I think it'd be especially helpful to say how many migrations to undo, since I expect when you're working on a new migration you might get it wrong a few times and only want to undo the one you're working on so you can try again.

Updated: December 18, 2023