PostgreSQL + Hibernate + Spring auto create database

后端 未结 6 1313
时光说笑
时光说笑 2020-12-18 07:08

I\'m working with PostgreSQL and Spring 4 and want my app auto create database when it running.

My Entity Class is:

@Entity
@Table(name = \"user\", s         


        
6条回答
  •  难免孤独
    2020-12-18 07:50

    you can have a schema.sql script with "CREATE SCHEMA IF NOT EXISTS x;" with

    spring.jpa.properties.hibernate.hbm2ddl.auto=update 
    

    It should work

提交回复
热议问题