Commit b218b54
Eugen Konkov
Pass direction to SQL::Translator::Diff
### Why direction of migration is required
Imagine this steps:
V1 | V2 | V3
--- | --- | ---
X | Y:RX | X
Where `X` is column name, `Y:RX` is column with `Y` name and `reanmed_from` property set to `X` name.
### What happens when we generate migration scripts
Migration | Diff result `[src, tar]` | Description
--- | --- | ---
v1 -> v2 | X, Y:RX | This works well. The `X` was renamed to `Y`.
v2 -> v3 | Y:RX, X | This is also expected. The `Y` was dropped and `X` was created.
v2 -> v1 | Y:RX, X | For downgrade script it is not expected that `Y` will be dropped and `X` will be created from scratch. During migration `v1->v2` it was renamed and now durint `v2->v1` we expect it should be renamed back. But this drop happens because it works as designed for `upgrade` direction. But this scenario it is `downgrade`. Unfortunately We can not detect this automatically: the order of `[src, dst]` is the same and the set of `extra` properties are the same.
(For now I am skipping more complex scenarios when `v3` migration has columns with created and/or renamed names similar to `v2` version and its consequences on `v1`)
### Proposition
From the above to get the expected result during `downgrades` we need to pass the direction that the
`downgrade` migration should be generated.1 parent b246341 commit b218b54
File tree
1 file changed
+1
-1
lines changed- lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL
1 file changed
+1
-1
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
536 | | - | |
| 536 | + | |
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
| |||
0 commit comments