feat(w5): dual Flyway history (V1-V6)

Migrations in db/migration/auth/ with separate flyway_schema_history_auth table:
- V1: users + user_identities (with provider/subject unique constraint)
- V2: memberships (polymorphic org_type/org_id, unique per user+org)
- V3: invitations (64-char token, status lifecycle)
- V4: access_requests (requester → reviewer workflow)
- V5: Microsoft tenant_id partial index on user_identities
- V6: login_events + refresh_tokens + revinfo actor_user_id column

PlateAuthFlywayConfig runs a second Flyway bean against flyway_schema_history_auth,
independent of consumer's own flyway_schema_history. Runs at bean init (before JPA).
This commit is contained in:
Patrick Plate
2026-06-24 15:48:00 +02:00
parent 63c953d9b9
commit a2e4393d05
7 changed files with 168 additions and 0 deletions
@@ -0,0 +1,28 @@
package de.platesoft.auth.config;
import org.flywaydb.core.Flyway;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
/**
* Configures a separate Flyway instance for plate-auth migrations.
* Uses its own history table (flyway_schema_history_auth) to avoid
* version collisions with the consumer application's migrations.
*/
@Configuration
@ConditionalOnClass(Flyway.class)
public class PlateAuthFlywayConfig {
@Bean(initMethod = "migrate")
public Flyway plateAuthFlyway(DataSource dataSource) {
return Flyway.configure()
.dataSource(dataSource)
.locations("classpath:db/migration/auth")
.table("flyway_schema_history_auth")
.baselineOnMigrate(true)
.load();
}
}