cloudspannerecosystem / wrench

wrench - Schema management tool for Cloud Spanner -
MIT License
239 stars 46 forks source link

Migration files with colliding numbers are not reported as error #47

Closed halmai closed 3 years ago

halmai commented 3 years ago

Expected Behavior

If there are more than one files starting with the same number in their names then they should be either processed individually or reported as an error. Silently pretending as if there were only one of them is pretty misleading.

If there are two files with the same number in their names then either process all of them or report an error saying "File names must have different numbers in their names."

Current Behavior

Wrench executes only one of these files and ignores the rest.

Steps to Reproduce

  1. Create two migration scripts and name them with the same number. For example, 20210831_123456_first.sql and 20210831_123456_second.sql
  2. Define a CREATE TABLE first(...) in the first one and CREATE TABLE second(...) in the second one.
  3. Do a migrate up
  4. See your database. Table first will be there, table second will not.
110y commented 3 years ago

@halmai

Currently, wrench executes all of migrations if versions are conflicted each other.

But, although wrench behave so, I think wrench should raise an error for that case. So, let me review your PR.

110y commented 3 years ago

Closed by https://github.com/cloudspannerecosystem/wrench/pull/48