mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-21 07:32:02 +00:00
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:
@@ -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
|
### 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.
|
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.
|
||||||
|
|||||||
1125
SQL/migrate-2023/V001__Schema_2023_08_16.sql
Normal file
1125
SQL/migrate-2023/V001__Schema_2023_08_16.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
# copy these into another file and use the -configFile switch on flyway
|
||||||
# flyway.url=jdbc:mysql://localhost/bs12
|
# flyway.url=jdbc:mysql://localhost/bs12
|
||||||
|
|||||||
Reference in New Issue
Block a user