Migrating a Flyway database to multiple schemes

I installed a migration script for my multi-user application. the problem was. it only generates scripts for the first tenant / scheme, which I specified in the parameter. Here is my sql script

drop table if exists ADMIN_ACCOUNT cascade;

drop table if exists PERSON_NAME cascade;

drop table if exists USER_ACCOUNT cascade;

create table ADMIN_ACCOUNT (
    id int8 not null,
    created_date timestamp,
    PASSWORD varchar(255),
    USERNAME varchar(255),
    membershipType varchar(255),
    NAME_ID int8,
    primary key (id)
);

create table PERSON_NAME (
    id int8 not null,
    created_date timestamp,
    FIRST_NAME varchar(255),
    LAST_NAME varchar(255),
    MIDDLE_NAME varchar(255),
    account_id int8,
    primary key (id)
);

create table USER_ACCOUNT (
    id int8 not null,
    created_date timestamp,
    PASSWORD varchar(255),
    USERNAME varchar(255),
    ROLE varchar(255),
    TENANT_CODE varchar(255),
    NAME_ID int8,
    primary key (id)
);

alter table ADMIN_ACCOUNT
add constraint FK_fil1krx8k0osj713tg44ia0vu
foreign key (NAME_ID)
references PERSON_NAME;

alter table PERSON_NAME
add constraint FK_hc1g7pa0rseytw9o1pcuo0mpw
foreign key (account_id)
references USER_ACCOUNT;

alter table USER_ACCOUNT
add constraint FK_ib2pk4at20vxm3onaoro6ry2r
foreign key (NAME_ID)
references PERSON_NAME;

Here is the team that I put in flight mvn compile flyway:migrate -Dflyway.schemas=tenant3,tenant4,tenant5 -Dflyway.baselineOnMigrate=true

It only generates tables for the first tenant, who is the tenant3.

This is mistake? or am i missing something?

+4
source share
2 answers

, Flyway , flyway.schemas . Flyway , ( ).

+2

Source: https://habr.com/ru/post/1568132/


All Articles