Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquibase: separate out test-data context from others #1257

Open
php-coder opened this issue Feb 12, 2020 · 0 comments
Open

Liquibase: separate out test-data context from others #1257

php-coder opened this issue Feb 12, 2020 · 0 comments
Labels
ADR/needed A decision has been made and it needs to be documented environment/test Issue affects only test environment refactoring
Milestone

Comments

@php-coder
Copy link
Owner

php-coder commented Feb 12, 2020

At this moment test-data context follow the same rules as others. Let's extract it and put it aside as it's different than others because it's applied to an in-memory database that is always created from scratch.

Advantages of the current approach:

  • test-data is treated similarly to prod-data: the migrations that modify data also applied to test data. This might help to catch mistakes in such migrations on early stages. But it can't catch them all and that's what Build scripts: check database upgrade before deploy #383 should cover.

Disadvantages of the current approach:

  • Adding a new test record in a table becomes difficult over time because a table structure is scattered between many migrations. This means that in order to identify what columns a table have, we need to look on all migrations that touched this table or we need to run a server and inspect a table in H2 console.
  • The similar applies to test data -- it's hard to predict what ID a new record would have because it requires to inspect all migrations.
  • copying&pasting isn't reliable as a table structure might have changed between migrations
  • when we add another one test record to a table, we can append it into an existing migration but after that a migration filename might get outdated. In this case, we can rename a file but it might be unsafe (as Liquibase remembers filenames).
  • because there is no way to distinguish changes of test-data from other types of change, we can't configure Danger to complain when migrations that touche non-test data have been modified.
@php-coder php-coder added refactoring environment/test Issue affects only test environment ADR/needed A decision has been made and it needs to be documented labels Feb 12, 2020
php-coder added a commit that referenced this issue Mar 6, 2020
…on with test data into separate tables.

Part of #1265
Related to #1257
php-coder added a commit that referenced this issue Mar 6, 2020
… migration with test data into separate tables.

Part of #1265
Related to #1257
@php-coder php-coder added this to the 0.4.8 milestone Jul 28, 2023
php-coder added a commit that referenced this issue Jul 28, 2023
…e migrations

Pre-requsite for #1621 in order to fix integration tests

Part of #1257
@php-coder php-coder modified the milestones: 0.4.8, 0.4.9 Dec 29, 2023
@php-coder php-coder modified the milestones: 0.4.9, next Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADR/needed A decision has been made and it needs to be documented environment/test Issue affects only test environment refactoring
Projects
None yet
Development

No branches or pull requests

1 participant