Condense Database Migrations (#17103)

* Condense Database Migrations

Condenses the Database Migrations into a new initial schema.
Also adds some instructions to the Database Readme for existing setups.

* Update readme/delete changed migrations since pr creation

* Reworks a bit how the previous migrations are handled and updates the instructions accordingly

* Expand the readme with baseline/migrate

---------

Co-authored-by: Werner <Arrow768@users.noreply.github.com>
This commit is contained in:
Werner
2023-08-19 22:32:13 +02:00
committed by GitHub
parent c93aa1dfba
commit a69a7316ab
84 changed files with 1149 additions and 1 deletions

View File

@@ -1,3 +1,25 @@
### Compacted Migrations
To decrease the runtime of the migration unit test, the database migrations will be compacted into a single migration on a regular base.
In order to do so, a new "migrate-VERSION" subfolder is created.
The initial migration in these subfolders is always a migration with the current db-schema as of the current PR.
In addition the flayway.conf file in the root of the project is updated to use the new migration folder and create a new schema history table (that tracks the applied migrations).
#### How does this impact you?
If you set up a new database:
Make sure to use the latest migration folder, it will contain everything needed to create a "fresh" database.
If you have a existing database:
Update to the latest migration in the migration folder that you have used so far.
Then switch to the next migration folder (and a new schema version table)
You should use flyway with `-baselineVersion="1" baseline` instead of the usual migrate for the initial migration
As usual, always make sure that you have a backup and test it first on a non-production copy
### Prerequisites
The server connects to a mysql-compatible server (mysql, mariadb, percona), so you'll need one of those with a database and user/password pair ready.

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
flyway.locations=filesystem:SQL/migrate
flyway.locations=filesystem:SQL/migrate-2023
flyway.table=schema_version_2023
# copy these into another file and use the -configFile switch on flyway
# flyway.url=jdbc:mysql://localhost/bs12