db-migrate / db-migrate/node-db-migrate

No order is guaranteed if migrations have the same date

Open
#646 6 comments 0 reactions 0 assignees View on GitHub
bug feature good first issue help wanted
Dominant language
JavaScript
Stars
2.3k
Forks
361
PR merge metrics
No merged PRs in 30d

Description

## I'm submitting a...
- [x] Bug report
- [ ] Feature request
- [ ] Question

## Current behavior
Migrations on the same date (i.e. same year, month, day, hour, minute and second) aren't applied with any discernible criteria:

![image](https://user-images.githubusercontent.com/14804609/63874246-76c4f080-c9c1-11e9-876e-ac8eeff41bdb.png)

## Expected behavior
I would expect the alphabetical order to be respected.

## Minimal reproduction of the problem with instructions
create a bunch of migrations (if you have a machine fast enough to create multiple migrations on the same second, otherwise simply rename them)

for i in `seq 1 100`; do npx db_migrate create x$i --sql-file --env dev; done

apply them:

npx db_migrate up --env dev

watch them be in a randomish order

## What is the motivation / use case for changing the behavior?
Avoid the confusion of users and breakage when auto-generating migrations

## Environment



db-migrate version: 0.11.6
db-migrate driver with versions: pg 1.0.0

Additional information:
- Node version: v10.15.3
- Platform: Linux (Ubuntu 18.04.3 LTS)

---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/79518314-no-order-is-guaranteed-if-migrations-have-the-same-date?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F73887&utm_medium=issues&utm_source=github).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.