Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
69 lines (57 sloc)
1.96 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Cockroach | Ebean ORM</title> | |
<meta name="layout" content="_layout2/base-docs.html"/> | |
<meta name="bread1" content="Database platforms" href="/docs/database"/> | |
<meta name="bread2" content="Cockroach" href="/docs/database/cockroach"/> | |
<#assign n0_docs="active"> | |
<#assign n1_platforms="active"> | |
<#assign n2_cockroach="active"> | |
</head> | |
<body> | |
<h2>Cockroach</h2> | |
<h3>Testing</h3> | |
<p> | |
To test against Cockroach docker test container set the <em>platform</em> to <code>cockroach</code> in | |
<code>src/test/resources/application-test.yaml</code> | |
</p> | |
<p> | |
Refer to <a href="/docs/testing">docs / testing</a> if application-test.yaml doesn't exist yet. | |
</p> | |
<pre content="yml"> | |
ebean: | |
test: | |
platform: cockroach #, h2, postgres, mysql, oracle, sqlserver | |
ddlMode: dropCreate # none | dropCreate | migrations | create | |
dbName: test | |
</pre> | |
<h2 id="ebean-cockroach">ebean-cockroach dependency</h2> | |
<p> | |
We can use the <code>io.ebean:ebean-cockroach</code> dependency rather than <code>io.ebean:ebean</code> if we want to only | |
bring in the CockroachDB specific platform code. Depending on <code>io.ebean:ebean</code> will bring in all platforms. | |
</p> | |
<h2 id="starting">Docker container</h2> | |
<p> | |
We can programmatically start a docker container version of CockroachDB. | |
</p> | |
<p> | |
The below uses <code>ebean-test-docker</code> dependency which already comes with <code>ebean-test</code>. | |
If we do not have a dependency on <code>ebean-test</code> then add <code>io.ebean:ebean-test-docker:5.0</code> | |
as a dependency. | |
</p> | |
<pre content="java"> | |
package main; | |
import io.ebean.docker.commands.CockroachContainer; | |
public class Main { | |
public static void main(String[] args) { | |
CockroachContainer container = CockroachContainer.newBuilder("v21.2.9") | |
.dbName("unit") | |
//.user("test_roach"); | |
.build(); | |
container.start(); | |
} | |
} | |
</pre> | |
<@next_edit "YugabyteDB" "/docs/database/yugabyte" "/docs/database/cockroach/index.html"/> | |
</body> | |
</html> |