Skip to content

Commit

Permalink
Merge branch 'master-upstream' into json-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rPraml committed Jun 16, 2023
2 parents 7761067 + 53b1e4d commit 994fb26
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ebean-profiling*.xml
/db
/mydb.db
profiling/
.DS_Store

# Intellij project files
*.iml
Expand Down
23 changes: 11 additions & 12 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Overview of ebean.properties file

### DbMigration options

You can set individual values for different platforms when generating migrations
You can set individual values for different platforms when generating migrations.

`dbmigration.platform.<PLATFORM>.databaseSequenceBatchSize`
For DB's using sequences this is the number of sequence values prefetched.

`dbmigration.platform.<PLATFORM>.dbuuid`
Control, how UUID generation should work - it affects DDL which column type is generated. Possible values:
Control, how UUID generation should work - it affects which column type is generated in DDL. Possible values:
- BINARY enforces binary UUID
- VARCHAR enforces varchar UUID
- BINARY_OPTIMIZED enforces binary-optimized UUID (makes sense only with Type1 ID)
Expand All @@ -19,7 +19,7 @@ Control, how UUID generation should work - it affects DDL which column type is g
- AUTO_VARCHAR (default) use varchar when platform does not support UUID

`dbmigration.platform.<PLATFORM>.uuidStoreAsBinary`
Same as setting dbuuid to BINARY
Same as setting dbuuid to BINARY.

`dbmigration.platform.<PLATFORM>.geometrySRID`
The Geometry SRID value (default 4326).
Expand All @@ -30,7 +30,6 @@ The ID type (IDENTITY, SEQUENCE, GENERATOR, EXTERNAL)
`dbmigration.platform.<PLATFORM>.mapping`
Adjust the mapping. For example `BOOLEAN=integer(32);BIT=tinyint(3)`


`ebean.migration.applyPrefix`
Set this to "V" to be compatible with FlywayDB.

Expand All @@ -50,7 +49,7 @@ Set to true if the DB migration should be generated on server start.
The version of a pending drop that should be generated as the next migration.

`ebean.migration.includeGeneratedFileComment`
TODO
Adds the header about the migration files being generated when true. Reading 'THIS IS A GENERATED FILE - DO NOT MODIFY'

`ebean.migration.metaTable`
For running migration the DB table that holds migration execution status. Default 'db_migration'
Expand All @@ -65,17 +64,17 @@ Subdirectory the model xml files go into. Default 'model'
Suffix. Default '.model.xml'

`ebean.migration.name`
Description text that can be appended to the version to become the ddl script file name
Description text that can be appended to the version to become the ddl script file name.

`ebean.migration.patchInsertOn`
migration versions that should be added to history without running.
Migration versions that should be added to history without running.

`ebean.migration.patchResetChecksumOn`
migration versions that should have their checksum reset and not run.
Use this if you get a 'Checksum mismatch' error.

`ebean.migration.placeholders`
A comma and equals delimited placeholders that are substituted in SQL scripts when running migration (used by DB Migration runner only).
A comma and equals delimited map of placeholders that are substituted in SQL scripts when running migration (used by DB Migration runner only).

`ebean.migration.platform`
The database platform to generate migration DDL for.
Expand All @@ -90,15 +89,15 @@ The migration version name (typically FlywayDb compatible). Example: 1.1.1_2
### Ebean UUID options

`ebean.uuidVersion`
Controls, how the UUIDs are generated. Possible values
Controls how the UUIDs are generated. Possible values:
- VERSION4 (default) generate random V4 UUIDs,
- VERSION1 generate rfc4122 compliant Type 1 UUIDs (requires a state file)
- VERSION1RND generate fake Type 1 UUIDs

Note, that V1 UUIDs in conjunction with AUTO_BINARY_OPTIMIZED will give you the best index performance, but you MUST understand how this works to avoid collisions.

`ebean.uuidStateFile`
The state file that is Required to generate V1 UUIDs
The state file that is required to generate V1 UUIDs.


### DocStoreConfig
Expand All @@ -107,7 +106,7 @@ The state file that is Required to generate V1 UUIDs
True when the Document store integration is active/on.

`ebean.docstore.allowAllCertificates`
Set to true such that the client allows connections to invalid/self signed SSL certificates.
Set to true such that the client allows connections to invalid/self-signed SSL certificates.

`ebean.docstore.bulkBatchSize`
The default batch size to use for the Bulk API calls.
Expand Down Expand Up @@ -192,7 +191,7 @@ Suffix appended to the base table to derive the view that contains the union of
Set to true if the DataSource uses autoCommit. Indicates that Ebean should use autoCommit friendly Transactions and TransactionManager.

`ebean.autoReadOnlyDataSource`
When true create a read only DataSource using readOnlyDataSourceConfig defaulting values from dataSourceConfig
When true create a read only DataSource using readOnlyDataSourceConfig defaulting values from dataSourceConfig.

`ebean.autostart`
Should the server start all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ protected String joinColumnNames(String[] columns) {
}
sb.append(normaliseColumn(columns[i]));
}
return sb.toString();
return sb.toString().replace(" ", "_");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public DbConstraintNormalise(boolean lowerCaseTables, boolean lowerCaseColumns)
* quoted identifier characters (",',[,] etc).
*/
public String normaliseTable(String tableName) {

tableName = trimQuotes(tableName);
int lastPeriod = tableName.lastIndexOf('.');
if (lastPeriod > -1) {
Expand Down Expand Up @@ -59,7 +58,6 @@ private String trimBrackets(String value) {
* Trim off the platform quoted identifier quotes like [ ' and ".
*/
public String trimQuotes(String identifier) {

if (identifier == null) {
return "";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,24 @@ public IndexDefinition(String[] columns, String name, boolean unique, Platform[]
}

/**
* Create a unique constraint given the column names.
* Create from JPA Index.
*/
public IndexDefinition(String name, String[] columns) {
public IndexDefinition(String name, String[] columns, boolean unique) {
this.columns = columns;
this.unique = true;
this.unique = unique;
this.name = name;
this.platforms = null;
this.concurrent = false;
this.definition = null;
}

/**
* Create a unique constraint given the column names.
*/
public IndexDefinition(String name, String[] columns) {
this(name, columns, true);
}

/**
* Return true if this can be used as a unique constraint.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ private void read(Class<?> cls) {
for (UniqueConstraint c : uniqueConstraints) {
descriptor.addIndex(new IndexDefinition(c.name(), convertColumnNames(c.columnNames())));
}
for (javax.persistence.Index index : table.indexes()) {
final String[] cols = index.columnList().split(",");
descriptor.addIndex(new IndexDefinition(index.name(), convertColumnNames(cols), index.unique()));
}
}
StorageEngine storage = typeGet(cls, StorageEngine.class);
if (storage != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public void testNormalise() {
assertThat(naming.normaliseTable("foo_bar]")).isEqualTo("foo_bar");
}

@Test
public void testIndexNameWithSpaces() {
assertThat(naming.indexName("foo", new String[]{"name", "other desc"})).isEqualTo("ix_foo_name_other_desc");
}

@Test
public void testDefaultToLower() {
assertThat(naming.normaliseTable("SCH.FOO_BAR]")).isEqualTo("foo_bar");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;

@Cache(readOnly = true)
@Entity
@Table(name = "feature_desc")
@Table(name = "feature_desc", indexes = @Index(columnList = "name, description desc"))
public class FeatureDescription {

@Id
Expand Down

0 comments on commit 994fb26

Please sign in to comment.