Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run multi tenant application - https://github.com/quarkusio/quarkus-quickstarts/tree/main/hibernate-orm-multi-tenancy-quickstart #1269

Open
i053322 opened this issue Apr 21, 2023 · 0 comments

Comments

@i053322
Copy link

i053322 commented Apr 21, 2023

I am new with quarkus I tried to check this example https://github.com/quarkusio/quarkus-quickstarts/tree/main/hibernate-orm-multi-tenancy-quickstart the SCHEMA Multitenancy . first I run the docker with

docker run -it --rm=true --name quarkus_test -e POSTGRES_USER=quarkus_test -e POSTGRES_PASSWORD=quarkus_test -e POSTGRES_DB=quarkus_test -p 5432:5432 postgres:13.3
and after i run the ./mvnw quarkus:dev I didn't see any schemas of base,mycompany i tried to change the application.properties

General settings

quarkus.log.level=INFO
%test.quarkus.log.level=INFO
%dev.quarkus.log.level=INFO
quarkus.native.native-image-xmx=5G

Hibernate ORM settings

quarkus.hibernate-orm.database.generation=none
quarkus.hibernate-orm.multitenant=SCHEMA
%database.quarkus.hibernate-orm.multitenant=DATABASE

SCHEMA Tenant Configuration (environment variable expansion is used to facilitate docker-compose setup)

quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=quarkus_test
quarkus.datasource.password=quarkus_test
quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_HOST_TENANT_BASE:localhost}:${DB_PORT_TENANT_BASE:5432}/quarkus_test
quarkus.datasource.jdbc.max-size=8
quarkus.datasource.jdbc.min-size=2
quarkus.flyway.schemas=base,mycompany
quarkus.flyway.locations=schema
quarkus.flyway.migrate-at-start=true
database.quarkus.flyway.schemas=
database.quarkus.flyway.locations=classpath:db/migration
database.quarkus.flyway.migrate-at-start=true
but I didn't see that any scheme was created. and this file https://github.com/quarkusio/quarkus-quickstarts/blob/main/hibernate-orm-multi-tenancy-quickstart/src/main/resources/schema/V1.0.0__create_fruits.sql didn't invoke

CREATE SEQUENCE base.known_fruits_id_seq;
SELECT setval('base."known_fruits_id_seq"', 3);
CREATE TABLE base.known_fruits
(
id INT,
name VARCHAR(40)
);
INSERT INTO base.known_fruits(id, name) VALUES (1, 'Cherry');
INSERT INTO base.known_fruits(id, name) VALUES (2, 'Apple');
INSERT INTO base.known_fruits(id, name) VALUES (3, 'Banana');

CREATE SEQUENCE mycompany.known_fruits_id_seq;
SELECT setval('mycompany."known_fruits_id_seq"', 3);
CREATE TABLE mycompany.known_fruits
(
id INT,
name VARCHAR(40)
);
INSERT INTO mycompany.known_fruits(id, name) VALUES (1, 'Avocado');
INSERT INTO mycompany.known_fruits(id, name) VALUES (2, 'Apricots');
INSERT INTO mycompany.known_fruits(id, name) VALUES (3, 'Blackberries');

@i053322 i053322 changed the title How to run multi tenant application - ttps://github.com/quarkusio/quarkus-quickstarts/tree/main/hibernate-orm-multi-tenancy-quickstart How to run multi tenant application - https://github.com/quarkusio/quarkus-quickstarts/tree/main/hibernate-orm-multi-tenancy-quickstart Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant