Open romach opened 8 years ago
@romach why do you think it must execute first in create then in data directory?
@vaa25 changesets must be executed according their chengeset numbers (000
, 001
, 002
, 003
)
@romach, @vaa25: there is an approach for dividing executing of changesets. Master changeset includes 2 sub-master changesets - create-tables
and add-data
. Order of executing and main idea is understand, I hope. Numbers are independent in every directory in that case.
@alex-anakin do you mean that initially changesets from create-tables
will be executed and then from add-data
according to your approach?
@romach exactly )
@vaa25 @alex-anakin Consider the case: We have following directory structure:
└── liquibase
└── create
├── table-1.sql
├── table-2.sql
└── data
├── insert-to-itable-1.sql
└── insert-to-itable-2.sql
Execution order will be table-1.sql > table-2.sql > insert-to-table-1.sql > insert-to-table-2.sql
Then we decide to change or delete column in table-2
.
So, now we have next directory structure:
└── liquibase
└── create
├── table-1.sql
├── table-2.sql
└── alter-column-in-table-2.sql
└── data
├── insert-in-table-1.sql
└── insert-in-table-2.sql
Execution order on the clean database will be table-1.sql > table-2.sql > alter-column-in-table-2.sql > insert-to-table-1.sql > insert-to-table-2.sql
But because we changed column in table-2
the errors will occur when we try to execute insert-in-table-2.sql
because of new table-2
structure.
@romach One of decisions of this situation is replacing changeset insert-in-table-2.sql
with new changeset insert-in-altered-table-2
, suitable to new table-2 structure after alter-column-in-table-2.sql
appplies
@AndriyBaibak this issue is not actual now
@romach if we will need to do this in future, i dont think that we must close this issue
Must be: during
liquibaseUpdate
changesets must be executed according their chengeset numbers. What is wrong: instead of that they are executed according directory structure: first - files increate
directory (000
,001
,003
, ...), then - indata
directory (002
,005
,007
, ...); How to reproduce: runliquibaseUpdate
task with--logLevel=debug
property (add it inbuild.gradle
)