Documentation / Setup / DDL - Create all
Overview
Ebean has the ability to generate and execute CREATE ALL
and DROP ALL
DDL
scripts which create all the tables. These are typically used when running tests and frequently these tests
run against H2 database rather than the target Postgres/Oracle/MySql/SQL Server ... database.
That is, when running a test or suite of tests the DB is created entirely from scratch.
When running a test or suite of tests the DB is created entirely from scratch
test-ebean.properties
Usually you set both ebean.ddl.generate
and ebean.ddl.run
to true in the
test-ebean.properties
(which is in src/test/resources) and in this way the CREATE ALL
DDL is only generated and executed when running tests.
ebean.ddl.generate=true
ebean.ddl.run=true
DB Migration
DB Migration is different in that DIFF
DDL scripts are generated for the changes to the model
and these DIFF
DDL scripts can be applied to the target Postgres/Oracle/MySql/SQL Server ... database and
often FlywayDb
or Liquibase
is used to apply those DDL changes.