diff --git a/pom.xml b/pom.xml
index 9105a2d..fcffb29 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,6 +71,14 @@
io.quarkus
quarkus-smallrye-jwt-build
+
+ io.quarkus
+ quarkus-flyway
+
+
+ org.flywaydb
+ flyway-database-postgresql
+
io.quarkus
quarkus-junit5
diff --git a/src/main/java/de/tavolio/account/AccountEntity.java b/src/main/java/de/tavolio/account/AccountEntity.java
index c061939..b9b54e6 100644
--- a/src/main/java/de/tavolio/account/AccountEntity.java
+++ b/src/main/java/de/tavolio/account/AccountEntity.java
@@ -20,6 +20,7 @@ public class AccountEntity extends PanacheEntityBase
private String email;
+ @Column(name = "account_password")
private String password;
@Enumerated(EnumType.STRING)
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 7323730..cb3f79c 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -3,16 +3,29 @@ quarkus.http.port=8089
quarkus.http.test-port=9089
%dev.quarkus.http.host=0.0.0.0
-quarkus.hibernate-orm.schema-management.strategy=drop-and-create
-
%dev.smallrye.jwt.sign.key.location=private.key
%dev.mp.jwt.verify.publickey.location=public.crt
mp.jwt.verify.issuer=https://tavolio.de
+# Postgres
+prod.quarkus.hibernate-orm.validate-in-dev-mode=false
+quarkus.hibernate-orm.schema-management.strategy=none
+quarkus.datasource.db-kind=postgresql
+
%dev.quarkus.datasource.username=postgres
%dev.quarkus.datasource.password=${DB_PASSWORD}
%dev.quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/postgres?currentSchema=iam
+%prod.quarkus.datasource.username=${DB_USER}
+%prod.quarkus.datasource.password=${DB_PASSWORD}
+%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_DATABASE}?currentSchema=${DB_SCHEMA}
+
+# Flyway
+%test.quarkus.flyway.clean-at-start=true
+%dev.quarkus.flyway.clean-at-start=true
+%dev.quarkus.flyway.locations=db/migration,db/dev
+quarkus.flyway.migrate-at-start=true
+
# IAM Superuser
%test,dev.iam.user.name=tavolio
%test,dev.iam.user.password=tavolio
\ No newline at end of file
diff --git a/src/main/resources/import.sql b/src/main/resources/db/dev/V9999__init.sql
old mode 100644
new mode 100755
similarity index 50%
rename from src/main/resources/import.sql
rename to src/main/resources/db/dev/V9999__init.sql
index 6b68a2d..2d0de2c
--- a/src/main/resources/import.sql
+++ b/src/main/resources/db/dev/V9999__init.sql
@@ -1,11 +1,4 @@
--- This file allow to write SQL commands that will be emitted in test and dev.
--- The commands are commented as their support depends of the database
--- insert into myentity (id, field) values(1, 'field-1');
--- insert into myentity (id, field) values(2, 'field-2');
--- insert into myentity (id, field) values(3, 'field-3');
--- alter sequence myentity_seq restart with 4;
-
-INSERT INTO account (id, firstname, lastname, email, password, status)
+INSERT INTO account (id, firstname, lastname, email, account_password, status)
VALUES ('66b261fe-4c5a-4728-9857-67717f02d4e1', 'Andreas', 'Dinauer', 'andreas.j.dinauer@gmail.com', '$2a$12$cdrzIY4sMFAXiz29uo9Ul.MPy0RN0FGS2yjVzb5BTe6bSijn4eGQy', 'REGISTERED');
INSERT INTO membership(id, tenant_type, tenant_id, member_role, member_since, account_id)
diff --git a/src/main/resources/db/migration/V1.0.1__init.sql b/src/main/resources/db/migration/V1.0.1__init.sql
new file mode 100755
index 0000000..2c66664
--- /dev/null
+++ b/src/main/resources/db/migration/V1.0.1__init.sql
@@ -0,0 +1,23 @@
+CREATE TABLE account (
+ email VARCHAR(255) NULL,
+ firstname VARCHAR(255) NULL,
+ id VARCHAR(255) NOT NULL,
+ lastname VARCHAR(255) NULL,
+ account_password VARCHAR(255) NULL,
+ status VARCHAR(255) NULL,
+ CONSTRAINT account_pkey PRIMARY KEY (id),
+ CONSTRAINT account_status_check CHECK (((status)::text = ANY ((ARRAY['INIT'::character varying, 'REGISTERED'::character varying])::text[])))
+);
+
+CREATE TABLE membership (
+ member_since TIMESTAMP(6) WITH TIME ZONE NOT NULL,
+ account_id VARCHAR(255) NOT NULL,
+ id VARCHAR(255) NOT NULL,
+ member_role VARCHAR(255) NOT NULL,
+ tenant_id VARCHAR(255) NOT NULL,
+ tenant_type VARCHAR(255) NOT NULL,
+ CONSTRAINT membership_member_role_check CHECK (((member_role)::text = ANY ((ARRAY['OWNER'::character varying, 'ADMIN'::character varying, 'MEMBER'::character varying])::text[]))),
+ CONSTRAINT membership_pkey PRIMARY KEY (id),
+ CONSTRAINT membership_tenant_type_check CHECK (((tenant_type)::text = ANY ((ARRAY['ORGANISATION'::character varying, 'RESTAURANT'::character varying])::text[]))),
+ CONSTRAINT fkd1yliqdvipm4yvq2tulbktpg6 FOREIGN KEY (account_id) REFERENCES account(id)
+);
\ No newline at end of file