mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 13:19:02 +00:00
![]() Several tests were manually running migrations in a large copy-paste blob of code. This makes the test less useful as it's possible to break the code while keeping the tests green by introducing a new migration that never gets run in the tests, and it's also difficult to reason about what the tests are doing. A new test helper library is introduced with a TestMigrationLoader that can both run Flyway migrations, or load specific migrations in the cases a specific set of migrations need to be loaded. Existing tests are migrated to use the new code. |
||
---|---|---|
.. | ||
src | ||
build.gradle | ||
readme.md |
DB
This module primarily contains SQL files for the URLs database. The most central tables are EC_DOMAIN
, EC_URL
and EC_PAGE_DATA
.
Flyway
The system uses flyway to track database changes and allow easy migrations, this is accessible via gradle tasks.
flywayMigrate
flywayBaseline
flywayRepair
flywayClean
(dangerous as in wipes your entire database)
Refer to the Flyway documentation for guidance. It's well documented and these are probably the only four tasks you'll ever need.
If you are not running the system via docker, you need to provide alternative connection details than the defaults (TODO: how?).
The migration files are in resources/db/migration. The file name convention incorporates the project's cal-ver versioning; and are applied in lexicographical order.
VYY_MM_v_nnn__description.sql
Central Paths
- migrations - Flyway migrations
See Also
- common/service implements DatabaseModule, which is from where the services get database connections.