Use timestamps instead of ids
Hi @cljoly ! Thank you for this awesome library!
How would you like the idea of using timestamps instead of migration ids? It would be consistent with things like Django and Rails. You probably already thought about it, would be interesting to know you opinion.
migrations/
├── 20250724014540-init
│ ├── down.sql
│ └── up.sql
├── 20250724014542-first
│ ├── down.sql
│ └── up.sql
├── 20250724014544-second
│ ├── down.sql
│ └── up.sql
└── 20250724014547-third
├── down.sql
└── up.sql
This check doesn't allow me to do it: https://github.com/cljoly/rusqlite_migration/blob/29f29255ad2b6dc92267a786d534b05d983af5f0/rusqlite_migration/src/loader.rs#L120
Hi @ivan1993spb, thanks for your kind words and for opening this issue.
Using consecutive numbers is aligned with the internal representation and so made the initial implementation of from_directory easier.
In that implementation, we don’t care that directories may not be returned in order, because we use the consecutive IDs to insert in the right place in the array. Thus we don’t have to run a sort.
If we supported timestamps, we would have to first sort the directories and then populate the array of migrations. That’s a bit more expensive when many migrations are defined and I’m not sure it is the right trade off for something that will run on every start of the program.
I could be persuaded otherwise though and in any case, I am adding a test in #291 to capture more of the existing behavior, in case we decide to change the underlying implementation in the future.