I have the following hibernate.cfg.xml file
The problem, when I run the migration, the schema is not getting created in the database. I would like to create the schema from scratch. It only generates the script.sql file.
This I the main app file
public class DatabaseMigration {
public static void main(String[] args){
StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().configure("/META-INF/hibernate.cfg.xml").build();
Metadata meta = new MetadataSources(ssr).getMetadataBuilder().build();
SchemaExport schemaExport = new SchemaExport();
schemaExport.setHaltOnError(true);
schemaExport.setFormat(true);
schemaExport.setDelimiter(";");
schemaExport.setOutputFile("db-schema.sql");
schemaExport.createOnly(EnumSet.of(TargetType.SCRIPT), meta);
}
}
question from:https://stackoverflow.com/questions/65945475/hibernate-does-not-create-schema-on-an-empty-databse