mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Compare commits
47
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df7b04877d | ||
|
|
4683877e0b | ||
|
|
9a4b9d4bec | ||
|
|
d0020ab8ce | ||
|
|
9b3b8ad46a | ||
|
|
68a6e98292 | ||
|
|
d61bdb028b | ||
|
|
9ddadb1338 | ||
|
|
fa1f225e67 | ||
|
|
7a72adedfa | ||
|
|
3d3e5c2c34 | ||
|
|
708f429c21 | ||
|
|
bca49ed2e2 | ||
|
|
e103ec7706 | ||
|
|
ca3c02bc1c | ||
|
|
9fc1bec6a9 | ||
|
|
f712635860 | ||
|
|
47a0e38eac | ||
|
|
870d90d055 | ||
|
|
ac1b30782a | ||
|
|
b63445e9c9 | ||
|
|
09f616aae8 | ||
|
|
994fb267ad | ||
|
|
53b1e4d682 | ||
|
|
c7f6c508a6 | ||
|
|
9109fd356f | ||
|
|
55477d4fab | ||
|
|
340281113f | ||
|
|
77610672a9 | ||
|
|
d8238735c1 | ||
|
|
f63b013ef9 | ||
|
|
6fe3ec9355 | ||
|
|
d1c21bf50a | ||
|
|
578560c2e2 | ||
|
|
0f9462b7b5 | ||
|
|
e89891038b | ||
|
|
2a7a2d4dd4 | ||
|
|
f499cc8c2c | ||
|
|
0dc4c6b11b | ||
|
|
f5d0777b86 | ||
|
|
81443b77bc | ||
|
|
2867c50090 | ||
|
|
c04171c1a5 | ||
|
|
e19cbdc2f6 | ||
|
|
3e2e84e8bf | ||
|
|
edb3759b3d | ||
|
|
7ee0610db1 |
@@ -11,6 +11,7 @@ ebean-profiling*.xml
|
||||
/db
|
||||
/mydb.db
|
||||
profiling/
|
||||
.DS_Store
|
||||
|
||||
# Intellij project files
|
||||
*.iml
|
||||
|
||||
+11
-12
@@ -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)
|
||||
@@ -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).
|
||||
@@ -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.
|
||||
|
||||
@@ -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'
|
||||
@@ -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.
|
||||
@@ -90,7 +89,7 @@ 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
|
||||
@@ -98,7 +97,7 @@ Controls, how the UUIDs are generated. Possible values
|
||||
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
|
||||
@@ -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.
|
||||
@@ -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
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-clickhouse</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-clickhouse</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-cockroach</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-db2</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-db2</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-h2</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-hana</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-hana</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-mariadb</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mariadb</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-mysql</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-mysql</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-nuodb</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-nuodb</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-oracle</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-oracle</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-postgres</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-sqlite</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlite</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-sqlserver</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean-yugabyte</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -41,13 +41,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>composites</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean (all platforms)</name>
|
||||
@@ -16,13 +16,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -40,7 +40,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-mapper</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -59,13 +59,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>composites</artifactId>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean api</name>
|
||||
|
||||
@@ -3,7 +3,7 @@ package io.ebean;
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
/**
|
||||
* Thrown when a foreign key constraint is enforced.
|
||||
* Thrown when a foreign key constraint is enforced or a field is too large.
|
||||
*/
|
||||
public class DataIntegrityException extends PersistenceException {
|
||||
private static final long serialVersionUID = -6740171949170180970L;
|
||||
@@ -14,4 +14,11 @@ public class DataIntegrityException extends PersistenceException {
|
||||
public DataIntegrityException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create with message only.
|
||||
*/
|
||||
public DataIntegrityException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,6 +540,7 @@ public class DatabaseConfig {
|
||||
|
||||
private String dumpMetricsOptions;
|
||||
|
||||
private LengthCheck lengthCheck = LengthCheck.OFF;
|
||||
private Function<String, String> metricNaming = MetricNamingMatch.INSTANCE;
|
||||
|
||||
/**
|
||||
@@ -2919,6 +2920,7 @@ public class DatabaseConfig {
|
||||
jdbcFetchSizeFindEach = p.getInt("jdbcFetchSizeFindEach", jdbcFetchSizeFindEach);
|
||||
jdbcFetchSizeFindList = p.getInt("jdbcFetchSizeFindList", jdbcFetchSizeFindList);
|
||||
databasePlatformName = p.get("databasePlatformName", databasePlatformName);
|
||||
lengthCheck = p.getEnum(LengthCheck.class, "lengthCheck", lengthCheck);
|
||||
|
||||
uuidVersion = p.getEnum(UuidVersion.class, "uuidVersion", uuidVersion);
|
||||
uuidStateFile = p.get("uuidStateFile", uuidStateFile);
|
||||
@@ -3419,6 +3421,20 @@ public class DatabaseConfig {
|
||||
this.metricNaming = metricNaming;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length check mode.
|
||||
*/
|
||||
public LengthCheck getLengthCheck() {
|
||||
return lengthCheck;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the length check mode.
|
||||
*/
|
||||
public void setLengthCheck(LengthCheck lengthCheck) {
|
||||
this.lengthCheck = lengthCheck;
|
||||
}
|
||||
|
||||
public enum UuidVersion {
|
||||
VERSION4,
|
||||
VERSION1,
|
||||
|
||||
@@ -144,7 +144,7 @@ public class DbConstraintNaming {
|
||||
}
|
||||
sb.append(normaliseColumn(columns[i]));
|
||||
}
|
||||
return sb.toString();
|
||||
return sb.toString().replace(" ", "_");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,6 @@ public class DbConstraintNormalise {
|
||||
* quoted identifier characters (",',[,] etc).
|
||||
*/
|
||||
public String normaliseTable(String tableName) {
|
||||
|
||||
tableName = trimQuotes(tableName);
|
||||
int lastPeriod = tableName.lastIndexOf('.');
|
||||
if (lastPeriod > -1) {
|
||||
@@ -59,7 +58,6 @@ public class DbConstraintNormalise {
|
||||
* Trim off the platform quoted identifier quotes like [ ' and ".
|
||||
*/
|
||||
public String trimQuotes(String identifier) {
|
||||
|
||||
if (identifier == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.ebean.config;
|
||||
|
||||
/**
|
||||
* Defines the length-check mode.
|
||||
*
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*/
|
||||
public enum LengthCheck {
|
||||
/**
|
||||
* By default, length checking is off. This means, strings/jsons and files are passed to the DB and the DB might or might not check the length.
|
||||
* The DB has to check the data length. Note this is not possible for certain datatypes (e.g. clob without size)
|
||||
*/
|
||||
OFF,
|
||||
/**
|
||||
* When enabling length check, ebean validates strings/json strings and files before saving them to DB.
|
||||
*/
|
||||
ON,
|
||||
/**
|
||||
* Same as "ON", but take the UTF8-bytelength for validation. This may be useful, if you have an UTF8 based charset (default for DB2)
|
||||
*/
|
||||
UTF8
|
||||
}
|
||||
@@ -28,6 +28,16 @@ public class DbPlatformType implements ExtraDbTypes {
|
||||
*/
|
||||
private final boolean canHaveLength;
|
||||
|
||||
/**
|
||||
* The maximum length supported by this platform type. If length is too big, fallback is used.
|
||||
*/
|
||||
private final int maxLength;
|
||||
|
||||
/**
|
||||
* Use this platform type if length exceedes
|
||||
*/
|
||||
private final DbPlatformType fallback;
|
||||
|
||||
/**
|
||||
* Parse a type definition into a DbPlatformType.
|
||||
* <p>
|
||||
@@ -53,6 +63,41 @@ public class DbPlatformType implements ExtraDbTypes {
|
||||
this(name, defaultLength, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct without length, but with a max length limit and a fallback type, that is used if maxLength is exceeded.
|
||||
* This can be used to use <ul>
|
||||
* <li>"longtext" for unspecified length</li>
|
||||
* <li>"text" for length up to 2^16-1</li>
|
||||
* <li>"mediumtext" for length up to 2^24-1</li>
|
||||
* <li>"longtext" else</li>
|
||||
* </ul>
|
||||
*/
|
||||
public DbPlatformType(String name, int maxLength, DbPlatformType fallback) {
|
||||
this.name = name;
|
||||
this.defaultLength = 0;
|
||||
this.defaultScale = 0;
|
||||
this.canHaveLength = false;
|
||||
this.maxLength = maxLength;
|
||||
this.fallback = fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct with a given default length, a max length limit and a fallback type, that is used if maxLength is exceeded.
|
||||
* This can be used to use <ul>
|
||||
* <li>"varchar(255)" for unspecified length</li>
|
||||
* <li>"varchar(N)" for N <= maxLength</li>
|
||||
* <li>"varchar(max)" else</li>
|
||||
* </ul>
|
||||
*/
|
||||
public DbPlatformType(String name, int defaultPrecision, int maxLength, DbPlatformType fallback) {
|
||||
this.name = name;
|
||||
this.defaultLength = defaultPrecision;
|
||||
this.defaultScale = 0;
|
||||
this.canHaveLength = true;
|
||||
this.maxLength = maxLength;
|
||||
this.fallback = fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct for Decimal with precision and scale.
|
||||
*/
|
||||
@@ -61,6 +106,8 @@ public class DbPlatformType implements ExtraDbTypes {
|
||||
this.defaultLength = defaultPrecision;
|
||||
this.defaultScale = defaultScale;
|
||||
this.canHaveLength = true;
|
||||
this.maxLength = Integer.MAX_VALUE;
|
||||
this.fallback = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,6 +121,8 @@ public class DbPlatformType implements ExtraDbTypes {
|
||||
this.defaultLength = 0;
|
||||
this.defaultScale = 0;
|
||||
this.canHaveLength = canHaveLength;
|
||||
this.maxLength = Integer.MAX_VALUE;
|
||||
this.fallback = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,33 +173,33 @@ public class DbPlatformType implements ExtraDbTypes {
|
||||
*/
|
||||
public String renderType(int deployLength, int deployScale, boolean strict) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(name);
|
||||
if (canHaveLength || !strict) {
|
||||
renderLengthScale(deployLength, deployScale, sb);
|
||||
}
|
||||
int len = deployLength != 0 ? deployLength : defaultLength;
|
||||
if (len > maxLength) {
|
||||
return fallback.renderType(deployLength, deployScale, strict);
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(name);
|
||||
if ((canHaveLength || !strict) && len > 0) {
|
||||
renderLengthScale(len, deployScale, sb);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the length and scale part of the column definition.
|
||||
*/
|
||||
protected void renderLengthScale(int deployLength, int deployScale, StringBuilder sb) {
|
||||
protected void renderLengthScale(int len, int deployScale, StringBuilder sb) {
|
||||
// see if there is a precision/scale to add (or not)
|
||||
int len = deployLength != 0 ? deployLength : defaultLength;
|
||||
if (len == Integer.MAX_VALUE) {
|
||||
sb.append("(max)"); // TODO: this is sqlserver specific
|
||||
} else if (len > 0) {
|
||||
sb.append("(");
|
||||
sb.append(len);
|
||||
int scale = deployScale != 0 ? deployScale : defaultScale;
|
||||
if (scale > 0) {
|
||||
sb.append(",");
|
||||
sb.append(scale);
|
||||
}
|
||||
sb.append(")");
|
||||
sb.append('(');
|
||||
sb.append(len);
|
||||
int scale = deployScale != 0 ? deployScale : defaultScale;
|
||||
if (scale > 0) {
|
||||
sb.append(',');
|
||||
sb.append(scale);
|
||||
}
|
||||
sb.append(')');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+25
-25
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean bom</name>
|
||||
@@ -89,25 +89,25 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -125,13 +125,13 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-mapper</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -155,46 +155,46 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>kotlin-querybean-generator</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgis</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-spring-txn</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- platforms -->
|
||||
@@ -202,67 +202,67 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-clickhouse</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-db2</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-h2</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-hana</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-mariadb</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-mysql</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-nuodb</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-oracle</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-postgres</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-sqlite</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-sqlserver</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -174,4 +174,9 @@ public interface DataBinder {
|
||||
*/
|
||||
String popJson();
|
||||
|
||||
/**
|
||||
* Returns the last bound object (e.g. for BindValidation). Note for InputStreams you'll get an InputStreamInfo.
|
||||
*/
|
||||
Object popLastObject();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.ebean.core.type;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Helper to transports length info of DataBind.setBinaryStream(stream, length) to BindValidation
|
||||
*
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*/
|
||||
public final class InputStreamInfo {
|
||||
|
||||
private final InputStream stream;
|
||||
private final long length;
|
||||
|
||||
public InputStreamInfo(InputStream stream, long length) {
|
||||
this.stream = stream;
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public InputStream stream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
public long length() {
|
||||
return length;
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-core</artifactId>
|
||||
@@ -22,7 +22,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -46,7 +46,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -159,21 +159,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-sqlserver</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package io.ebeaninternal.server.bind;
|
||||
|
||||
import io.ebean.core.type.DataBinder;
|
||||
import io.ebean.core.type.InputStreamInfo;
|
||||
import io.ebeaninternal.api.CoreLog;
|
||||
import io.ebeaninternal.server.core.timezone.DataTimeZone;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -23,6 +27,8 @@ public class DataBind implements DataBinder {
|
||||
protected int pos;
|
||||
private String json;
|
||||
|
||||
private Object lastObject = null;
|
||||
|
||||
public DataBind(DataTimeZone dataTimeZone, PreparedStatement pstmt, Connection connection) {
|
||||
this.dataTimeZone = dataTimeZone;
|
||||
this.pstmt = pstmt;
|
||||
@@ -65,16 +71,19 @@ public class DataBind implements DataBinder {
|
||||
@Override
|
||||
public void setObject(Object value) throws SQLException {
|
||||
pstmt.setObject(++pos, value);
|
||||
lastObject = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setObject(Object value, int sqlType) throws SQLException {
|
||||
pstmt.setObject(++pos, value, sqlType);
|
||||
lastObject = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNull(int jdbcType) throws SQLException {
|
||||
pstmt.setNull(++pos, jdbcType);
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,7 +105,7 @@ public class DataBind implements DataBinder {
|
||||
}
|
||||
}
|
||||
|
||||
private void closeInputStreams() {
|
||||
public void closeInputStreams() {
|
||||
if (inputStreams != null) {
|
||||
for (InputStream inputStream : inputStreams) {
|
||||
try {
|
||||
@@ -117,36 +126,43 @@ public class DataBind implements DataBinder {
|
||||
@Override
|
||||
public void setString(String value) throws SQLException {
|
||||
pstmt.setString(++pos, value);
|
||||
lastObject = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setInt(int value) throws SQLException {
|
||||
pstmt.setInt(++pos, value);
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setLong(long value) throws SQLException {
|
||||
pstmt.setLong(++pos, value);
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setShort(short value) throws SQLException {
|
||||
pstmt.setShort(++pos, value);
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setFloat(float value) throws SQLException {
|
||||
pstmt.setFloat(++pos, value);
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setDouble(double value) throws SQLException {
|
||||
pstmt.setDouble(++pos, value);
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setBigDecimal(BigDecimal value) throws SQLException {
|
||||
pstmt.setBigDecimal(++pos, value);
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,6 +173,7 @@ public class DataBind implements DataBinder {
|
||||
} else {
|
||||
pstmt.setDate(++pos, value);
|
||||
}
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,6 +184,7 @@ public class DataBind implements DataBinder {
|
||||
} else {
|
||||
pstmt.setTimestamp(++pos, value);
|
||||
}
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -177,26 +195,31 @@ public class DataBind implements DataBinder {
|
||||
} else {
|
||||
pstmt.setTime(++pos, value);
|
||||
}
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBoolean(boolean value) throws SQLException {
|
||||
pstmt.setBoolean(++pos, value);
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBytes(byte[] value) throws SQLException {
|
||||
pstmt.setBytes(++pos, value);
|
||||
lastObject = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setByte(byte value) throws SQLException {
|
||||
pstmt.setByte(++pos, value);
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChar(char value) throws SQLException {
|
||||
pstmt.setString(++pos, String.valueOf(value));
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -211,21 +234,31 @@ public class DataBind implements DataBinder {
|
||||
}
|
||||
inputStreams.add(inputStream);
|
||||
pstmt.setBinaryStream(++pos, inputStream, length);
|
||||
lastObject = new InputStreamInfo(inputStream, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlob(byte[] bytes) throws SQLException {
|
||||
pstmt.setBinaryStream(++pos, new ByteArrayInputStream(bytes), bytes.length);
|
||||
lastObject = bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setClob(String content) throws SQLException {
|
||||
pstmt.setCharacterStream(++pos, new StringReader(content), content.length());
|
||||
lastObject = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setArray(String arrayType, Object[] elements) throws SQLException {
|
||||
pstmt.setArray(++pos, connection.createArrayOf(arrayType, elements));
|
||||
lastObject = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object popLastObject() {
|
||||
Object ret = lastObject;
|
||||
lastObject = null;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public interface Persister {
|
||||
/**
|
||||
* Execute or queue the update.
|
||||
*/
|
||||
void executeOrQueue(SpiSqlUpdate update, SpiTransaction t, boolean queue);
|
||||
void executeOrQueue(SpiSqlUpdate update, SpiTransaction t, boolean queue, int queuePosition);
|
||||
|
||||
/**
|
||||
* Queue the SqlUpdate for execution with position 0, 1 or 2 defining
|
||||
|
||||
@@ -105,6 +105,7 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
private final String asOfViewSuffix;
|
||||
private final boolean jacksonCorePresent;
|
||||
private final int queryPlanTTLSeconds;
|
||||
private final BindMaxLength bindMaxLength;
|
||||
private int entityBeanCount;
|
||||
private List<BeanDescriptor<?>> immutableDescriptorList;
|
||||
/**
|
||||
@@ -159,6 +160,19 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
this.changeLogListener = config.changeLogListener(bootupClasses.getChangeLogListener());
|
||||
this.changeLogRegister = config.changeLogRegister(bootupClasses.getChangeLogRegister());
|
||||
this.jacksonCorePresent = config.isJacksonCorePresent();
|
||||
this.bindMaxLength = initMaxLength();
|
||||
}
|
||||
|
||||
BindMaxLength initMaxLength() {
|
||||
LengthCheck lengthCheck = this.config.getLengthCheck();
|
||||
switch (lengthCheck) {
|
||||
case OFF:
|
||||
return null;
|
||||
case UTF8:
|
||||
return BindMaxLength.ofUtf8();
|
||||
default:
|
||||
return BindMaxLength.ofStandard();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1502,6 +1516,10 @@ public final class BeanDescriptorManager implements BeanDescriptorMap, SpiBeanTy
|
||||
return list;
|
||||
}
|
||||
|
||||
public BindMaxLength bindMaxLength() {
|
||||
return bindMaxLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparator to sort the BeanDescriptors by name.
|
||||
*/
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonToken;
|
||||
import io.ebean.DataIntegrityException;
|
||||
import io.ebean.ValuePair;
|
||||
import io.ebean.bean.EntityBean;
|
||||
import io.ebean.bean.EntityBeanIntercept;
|
||||
import io.ebean.bean.MutableValueInfo;
|
||||
import io.ebean.bean.PersistenceContext;
|
||||
import io.ebean.config.EncryptKey;
|
||||
import io.ebean.config.LengthCheck;
|
||||
import io.ebean.config.dbplatform.DbEncryptFunction;
|
||||
import io.ebean.config.dbplatform.DbPlatformType;
|
||||
import io.ebean.config.dbplatform.ExtraDbTypes;
|
||||
import io.ebean.core.type.DataReader;
|
||||
import io.ebean.core.type.DocPropertyType;
|
||||
import io.ebean.core.type.InputStreamInfo;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
import io.ebean.plugin.Property;
|
||||
import io.ebean.text.StringParser;
|
||||
@@ -46,6 +50,7 @@ import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import java.util.List;
|
||||
@@ -166,6 +171,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
*/
|
||||
private final String dbComment;
|
||||
private final DbEncryptFunction dbEncryptFunction;
|
||||
private final BindMaxLength bindMaxLength;
|
||||
private int deployOrder;
|
||||
final boolean jsonSerialize;
|
||||
final boolean jsonDeserialize;
|
||||
@@ -258,6 +264,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
}
|
||||
this.jsonSerialize = deploy.isJsonSerialize();
|
||||
this.jsonDeserialize = deploy.isJsonDeserialize();
|
||||
this.bindMaxLength = deploy.bindMaxLength();
|
||||
}
|
||||
|
||||
private String tableAliasIntern(BeanDescriptor<?> descriptor, String s, boolean dbEncrypted, String dbColumn) {
|
||||
@@ -345,6 +352,7 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
this.elPlaceHolderEncrypted = override.replace(source.elPlaceHolderEncrypted, source.dbColumn);
|
||||
this.jsonSerialize = source.jsonSerialize;
|
||||
this.jsonDeserialize = source.jsonDeserialize;
|
||||
this.bindMaxLength = source.bindMaxLength;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -554,6 +562,18 @@ public class BeanProperty implements ElPropertyValue, Property, STreeProperty {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void bind(DataBind b, Object value) throws SQLException {
|
||||
scalarType.bind(b, value);
|
||||
if (bindMaxLength != null) {
|
||||
Object obj = b.popLastObject();
|
||||
long length = bindMaxLength.length(dbLength, obj);
|
||||
if (length > dbLength) {
|
||||
b.closeInputStreams();
|
||||
String s = String.valueOf(value); // take original bind value here.
|
||||
if (s.length() > 50) {
|
||||
s = s.substring(0, 47) + "...";
|
||||
}
|
||||
throw new DataIntegrityException("Cannot bind value '" + s + "' (effective length=" + length + ") to column '" + dbColumn + "' (length=" + dbLength + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings(value = "unchecked")
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package io.ebeaninternal.server.deploy;
|
||||
|
||||
import io.ebean.core.type.InputStreamInfo;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public interface BindMaxLength {
|
||||
|
||||
/**
|
||||
* Return a UTF8 based implementation.
|
||||
*/
|
||||
static BindMaxLength ofUtf8() {
|
||||
return new UTF8();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a standard implementation.
|
||||
*/
|
||||
static BindMaxLength ofStandard() {
|
||||
return new Standard();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the length of the object.
|
||||
*/
|
||||
long length(int dbLength, Object obj);
|
||||
|
||||
final class UTF8 implements BindMaxLength {
|
||||
|
||||
@Override
|
||||
public long length(int dbLength, Object obj) {
|
||||
if (obj instanceof String) {
|
||||
String s = (String) obj;
|
||||
int stringLength = s.length();
|
||||
if (stringLength > dbLength) {
|
||||
return stringLength;
|
||||
} else if (stringLength * 4 <= dbLength) {
|
||||
return -1;
|
||||
} else {
|
||||
return s.getBytes(StandardCharsets.UTF_8).length;
|
||||
}
|
||||
|
||||
} else if (obj instanceof byte[]) {
|
||||
return ((byte[]) obj).length;
|
||||
} else if (obj instanceof InputStreamInfo) {
|
||||
return ((InputStreamInfo) obj).length();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final class Standard implements BindMaxLength {
|
||||
|
||||
@Override
|
||||
public long length(int dbLength, Object obj) {
|
||||
if (obj instanceof String) {
|
||||
return ((String) obj).length();
|
||||
} else if (obj instanceof byte[]) {
|
||||
return ((byte[]) obj).length;
|
||||
} else if (obj instanceof InputStreamInfo) {
|
||||
return ((InputStreamInfo) obj).length();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,17 +27,24 @@ public final class IndexDefinition {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -139,6 +139,10 @@ public class DeployBeanDescriptor<T> {
|
||||
this.beanType = beanType;
|
||||
}
|
||||
|
||||
public BindMaxLength bindMaxLength() {
|
||||
return manager.bindMaxLength();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the IdClass to use.
|
||||
*/
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package io.ebeaninternal.server.deploy.meta;
|
||||
|
||||
import io.avaje.lang.Nullable;
|
||||
import io.ebean.annotation.*;
|
||||
import io.ebean.config.ScalarTypeConverter;
|
||||
import io.ebean.config.dbplatform.DbDefaultValue;
|
||||
import io.ebean.config.dbplatform.DbEncrypt;
|
||||
import io.ebean.config.dbplatform.DbEncryptFunction;
|
||||
import io.ebean.config.dbplatform.ExtraDbTypes;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
import io.ebean.util.AnnotationUtil;
|
||||
import io.ebeaninternal.server.core.InternString;
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.BindMaxLength;
|
||||
import io.ebeaninternal.server.deploy.DbMigrationInfo;
|
||||
import io.ebeaninternal.server.deploy.DeployDocPropertyOptions;
|
||||
import io.ebeaninternal.server.deploy.generatedproperty.GeneratedProperty;
|
||||
@@ -1133,4 +1136,20 @@ public class DeployBeanProperty {
|
||||
boolean isJsonType() {
|
||||
return mutationDetection != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public BindMaxLength bindMaxLength() {
|
||||
if (dbLength == 0) {
|
||||
return null;
|
||||
}
|
||||
switch (dbType) {
|
||||
case Types.VARCHAR:
|
||||
case Types.BLOB:
|
||||
case ExtraDbTypes.JSON:
|
||||
return desc.bindMaxLength();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,10 @@ final class AnnotationClass extends AnnotationParser {
|
||||
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) {
|
||||
|
||||
@@ -81,7 +81,10 @@ public final class BatchControl {
|
||||
*/
|
||||
private int bufferMax;
|
||||
|
||||
private final Queue[] queues = new Queue[3];
|
||||
private final Queue[] queues = new Queue[2];
|
||||
|
||||
static final int DELETE_QUEUE = 0;
|
||||
static final int INSERT_QUEUE = 1;
|
||||
|
||||
/**
|
||||
* Create for a given transaction, PersistExecute, default size and getGeneratedKeys.
|
||||
@@ -265,10 +268,9 @@ public final class BatchControl {
|
||||
}
|
||||
|
||||
private void flushBuffer(boolean reset) throws BatchedSqlException {
|
||||
flushQueue(queues[0]);
|
||||
flushInternal(reset);
|
||||
flushQueue(queues[1]);
|
||||
flushQueue(queues[2]);
|
||||
flushQueue(queues[DELETE_QUEUE]);
|
||||
flushQueue(queues[INSERT_QUEUE]);
|
||||
}
|
||||
|
||||
private void flushQueue(Queue queue) throws BatchedSqlException {
|
||||
|
||||
@@ -106,9 +106,9 @@ public final class DefaultPersister implements Persister {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeOrQueue(SpiSqlUpdate update, SpiTransaction t, boolean queue) {
|
||||
public void executeOrQueue(SpiSqlUpdate update, SpiTransaction t, boolean queue, int queuePosition) {
|
||||
if (queue) {
|
||||
addToFlushQueue(update, t, 2);
|
||||
addToFlushQueue(update, t, queuePosition);
|
||||
} else {
|
||||
executeSqlUpdate(update, t);
|
||||
}
|
||||
@@ -907,7 +907,7 @@ public final class DefaultPersister implements Persister {
|
||||
void deleteManyIntersection(EntityBean bean, BeanPropertyAssocMany<?> many, SpiTransaction t, boolean publish, boolean queue) {
|
||||
SpiSqlUpdate sqlDelete = deleteAllIntersection(bean, many, publish);
|
||||
if (queue) {
|
||||
addToFlushQueue(sqlDelete, t, 1);
|
||||
addToFlushQueue(sqlDelete, t, BatchControl.DELETE_QUEUE);
|
||||
} else {
|
||||
executeSqlUpdate(sqlDelete, t);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ abstract class SaveManyBase implements SaveMany {
|
||||
final void preElementCollectionUpdate() {
|
||||
if (!insertedParent) {
|
||||
request.preElementCollectionUpdate();
|
||||
persister.addToFlushQueue(many.deleteByParentId(request.beanId(), null), transaction, 1);
|
||||
persister.addToFlushQueue(many.deleteByParentId(request.beanId(), null), transaction, BatchControl.DELETE_QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
// build a intersection row for 'delete'
|
||||
IntersectionRow intRow = many.buildManyToManyMapBean(parentBean, otherDelete, publish);
|
||||
SpiSqlUpdate sqlDelete = intRow.createDelete(server, DeleteMode.HARD);
|
||||
persister.executeOrQueue(sqlDelete, transaction, queue);
|
||||
persister.executeOrQueue(sqlDelete, transaction, queue, BatchControl.DELETE_QUEUE);
|
||||
}
|
||||
}
|
||||
if (additions != null && !additions.isEmpty()) {
|
||||
@@ -314,7 +314,7 @@ final class SaveManyBeans extends SaveManyBase {
|
||||
// build a intersection row for 'insert'
|
||||
IntersectionRow intRow = many.buildManyToManyMapBean(parentBean, otherBean, publish);
|
||||
SpiSqlUpdate sqlInsert = intRow.createInsert(server);
|
||||
persister.executeOrQueue(sqlInsert, transaction, queue);
|
||||
persister.executeOrQueue(sqlInsert, transaction, queue, BatchControl.INSERT_QUEUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ final class SaveManyElementCollection extends SaveManyBase {
|
||||
final SpiSqlUpdate sqlInsert = proto.copy();
|
||||
sqlInsert.setParameter(parentId);
|
||||
many.bindElementValue(sqlInsert, value);
|
||||
persister.addToFlushQueue(sqlInsert, transaction, 2);
|
||||
persister.addToFlushQueue(sqlInsert, transaction, BatchControl.INSERT_QUEUE);
|
||||
}
|
||||
resetModifyState();
|
||||
postElementCollectionUpdate();
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ final class SaveManyElementCollectionMap extends SaveManyBase {
|
||||
sqlInsert.setParameter(parentId);
|
||||
sqlInsert.setParameter(entry.getKey());
|
||||
many.bindElementValue(sqlInsert, entry.getValue());
|
||||
persister.addToFlushQueue(sqlInsert, transaction, 2);
|
||||
persister.addToFlushQueue(sqlInsert, transaction, BatchControl.INSERT_QUEUE);
|
||||
}
|
||||
resetModifyState();
|
||||
postElementCollectionUpdate();
|
||||
|
||||
@@ -385,7 +385,10 @@ public final class CQuery<T> implements DbReadContext, CancelableQuery, SpiProfi
|
||||
this.lazyLoadParentId = lazyLoadParentId;
|
||||
}
|
||||
// add the loadedBean to the appropriate collection of lazyLoadParentBean
|
||||
lazyLoadManyProperty.addBeanToCollectionWithCreate(lazyLoadParentBean, bean, true);
|
||||
if (lazyLoadParentBean != null) {
|
||||
// Note: parentBean can be null, when GC ran between construction of query and building the retrieved bean
|
||||
lazyLoadManyProperty.addBeanToCollectionWithCreate(lazyLoadParentBean, bean, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-8
@@ -52,7 +52,7 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
return transactionManager.dataSource();
|
||||
}
|
||||
|
||||
private TransactionSynchronizationRegistry getSyncRegistry() {
|
||||
private TransactionSynchronizationRegistry registry() {
|
||||
try {
|
||||
InitialContext ctx = new InitialContext();
|
||||
return (TransactionSynchronizationRegistry) ctx.lookup("java:comp/TransactionSynchronizationRegistry");
|
||||
@@ -61,7 +61,7 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
}
|
||||
}
|
||||
|
||||
private UserTransaction getUserTransaction() {
|
||||
private UserTransaction userTransaction() {
|
||||
try {
|
||||
InitialContext ctx = new InitialContext();
|
||||
return (UserTransaction) ctx.lookup("java:comp/UserTransaction");
|
||||
@@ -78,11 +78,16 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
*/
|
||||
@Override
|
||||
public Object getCurrentTransaction() {
|
||||
TransactionSynchronizationRegistry syncRegistry = getSyncRegistry();
|
||||
SpiTransaction t = (SpiTransaction) syncRegistry.getResource(EBEAN_TXN_RESOURCE);
|
||||
if (t != null) {
|
||||
// we have already seen this transaction
|
||||
return t;
|
||||
TransactionSynchronizationRegistry syncRegistry = registry();
|
||||
try {
|
||||
SpiTransaction t = (SpiTransaction) syncRegistry.getResource(EBEAN_TXN_RESOURCE);
|
||||
if (t != null) {
|
||||
// we have already seen this transaction
|
||||
return t;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// deem that there is no current transaction
|
||||
return null;
|
||||
}
|
||||
|
||||
// check current Ebean transaction
|
||||
@@ -93,7 +98,7 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
return currentEbeanTransaction;
|
||||
}
|
||||
|
||||
UserTransaction ut = getUserTransaction();
|
||||
UserTransaction ut = userTransaction();
|
||||
if (ut == null) {
|
||||
// no current JTA transaction
|
||||
if (log.isLoggable(DEBUG)) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean ddl generation</name>
|
||||
@@ -28,14 +28,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+1
@@ -15,6 +15,7 @@ class ClickHouseDbArray {
|
||||
mapping.put("integer[]", "Array(UInt32)");
|
||||
mapping.put("bigint[]", "Array(UInt64)");
|
||||
mapping.put("float[]", "Array(Float32)");
|
||||
mapping.put("float4[]", "Array(Float32)");
|
||||
mapping.put("decimal[]", "Array(Decimal)");
|
||||
}
|
||||
|
||||
|
||||
+17
-7
@@ -279,7 +279,13 @@ public class PlatformDdl {
|
||||
if (type == null) {
|
||||
return null;
|
||||
}
|
||||
type = extract(type);
|
||||
String[] tmp = type.split(";", -1); // do not discard trailing empty strings
|
||||
int index = extract(tmp);
|
||||
if (index < tmp.length - 1) {
|
||||
// this is a platform specific definition. So do not apply further conversions
|
||||
return tmp[index];
|
||||
}
|
||||
type = tmp[index];
|
||||
if (type.contains("[]")) {
|
||||
return convertArrayType(type);
|
||||
}
|
||||
@@ -294,18 +300,22 @@ public class PlatformDdl {
|
||||
return null;
|
||||
}
|
||||
String[] tmp = type.split(";", -1); // do not discard trailing empty strings
|
||||
if (tmp.length % 2 == 0) {
|
||||
throw new IllegalArgumentException("You need an odd number of arguments in '" + type + "'. See Issue #2559 for details");
|
||||
return tmp[extract(tmp)]; // else
|
||||
}
|
||||
|
||||
protected int extract(String[] types) {
|
||||
if (types.length % 2 == 0) {
|
||||
throw new IllegalArgumentException("You need an odd number of arguments in '" + String.join(";", types) + "'. See Issue #2559 for details");
|
||||
}
|
||||
for (int i = 0; i < tmp.length - 2; i += 2) {
|
||||
String[] platforms = tmp[i].split(",");
|
||||
for (int i = 0; i < types.length - 2; i += 2) {
|
||||
String[] platforms = types[i].split(",");
|
||||
for (String plat : platforms) {
|
||||
if (platform.isPlatform(Platform.valueOf(plat.toUpperCase(Locale.ENGLISH)))) {
|
||||
return tmp[i + 1];
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return tmp[tmp.length - 1]; // else
|
||||
return types.length - 1; // else
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+7
-1
@@ -10,17 +10,23 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class MySqlPlatformTest {
|
||||
|
||||
MySqlPlatform mySqlPlatform = new MySqlPlatform();
|
||||
|
||||
private static int X = 0xFFFFFF;
|
||||
@Test
|
||||
public void testTypeConversion() {
|
||||
PlatformDdl ddl = PlatformDdlBuilder.create(mySqlPlatform);
|
||||
assertThat(ddl.convert("clob")).isEqualTo("longtext");
|
||||
assertThat(ddl.convert("clob(65535)")).isEqualTo("text");
|
||||
assertThat(ddl.convert("clob(65536)")).isEqualTo("mediumtext");
|
||||
assertThat(ddl.convert("clob(16777215)")).isEqualTo("mediumtext");
|
||||
assertThat(ddl.convert("clob(16777216)")).isEqualTo("longtext");
|
||||
assertThat(ddl.convert("json")).isEqualTo("json");
|
||||
assertThat(ddl.convert("jsonb")).isEqualTo("json");
|
||||
assertThat(ddl.convert("varchar(20)")).isEqualTo("varchar(20)");
|
||||
assertThat(ddl.convert("boolean")).isEqualTo("tinyint(1)");
|
||||
assertThat(ddl.convert("bit")).isEqualTo("tinyint(1)");
|
||||
assertThat(ddl.convert("decimal")).isEqualTo("decimal(16,3)");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-1
@@ -19,7 +19,7 @@ public class SqlserverPlatformTest {
|
||||
PlatformDdl ddl = PlatformDdlBuilder.create(platform);
|
||||
|
||||
assertThat(ddl.convert("clob")).isEqualTo("nvarchar(max)");
|
||||
assertThat(ddl.convert("blob")).isEqualTo("image");
|
||||
assertThat(ddl.convert("blob")).isEqualTo("varbinary(max)");
|
||||
assertThat(ddl.convert("json")).isEqualTo("nvarchar(max)");
|
||||
assertThat(ddl.convert("jsonb")).isEqualTo("nvarchar(max)");
|
||||
|
||||
@@ -32,6 +32,10 @@ public class SqlserverPlatformTest {
|
||||
assertThat(ddl.convert("bit")).isEqualTo("bit");
|
||||
assertThat(ddl.convert("tinyint")).isEqualTo("smallint");
|
||||
assertThat(ddl.convert("binary(16)")).isEqualTo("binary(16)");
|
||||
|
||||
assertThat(ddl.convert("varchar")).isEqualTo("nvarchar(255)");
|
||||
assertThat(ddl.convert("varchar(4000)")).isEqualTo("nvarchar(4000)");
|
||||
assertThat(ddl.convert("varchar(4001)")).isEqualTo("nvarchar(max)");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core-type</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean postgis</name>
|
||||
@@ -22,14 +22,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-postgres</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- provided scope -->
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean querybean</name>
|
||||
@@ -17,7 +17,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -63,21 +63,21 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+6
-6
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-redis</artifactId>
|
||||
@@ -22,35 +22,35 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-api</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-querybean</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>querybean-generator</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ebean-spring-txn</artifactId>
|
||||
@@ -28,7 +28,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-test</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+6
-6
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<artifactId>ebean-parent</artifactId>
|
||||
<groupId>io.ebean</groupId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>ebean test</name>
|
||||
@@ -28,20 +28,20 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-h2</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-core</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-ddl-generator</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -132,14 +132,14 @@
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-jackson-mapper</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.ebean</groupId>
|
||||
<artifactId>ebean-platform-all</artifactId>
|
||||
<version>13.19.0</version>
|
||||
<version>13.20.1-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class ClickHouseSetup implements PlatformSetup {
|
||||
config.setUsername("default");
|
||||
config.setPassword("");
|
||||
config.setUrl("jdbc:clickhouse://${host}:${port}/${databaseName}");
|
||||
config.setDriver("ru.yandex.clickhouse.ClickHouseDriver");
|
||||
config.setDriver("com.clickhouse.jdbc.ClickHouseDriver");
|
||||
config.datasourceDefaults();
|
||||
|
||||
return dockerProperties(config);
|
||||
|
||||
@@ -31,6 +31,11 @@ public class DbConstraintNamingTest {
|
||||
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");
|
||||
|
||||
@@ -62,7 +62,7 @@ class DbTypeMapTest {
|
||||
assertThat(dbTypeMap.lookup("json", false).renderType(0, 0)).isEqualTo("nvarchar(max)");
|
||||
assertThat(dbTypeMap.lookup("jsonb", false).renderType(0, 0)).isEqualTo("nvarchar(max)");
|
||||
assertThat(dbTypeMap.lookup("jsonclob", false).renderType(0, 0)).isEqualTo("nvarchar(max)");
|
||||
assertThat(dbTypeMap.lookup("jsonblob", false).renderType(0, 0)).isEqualTo("image");
|
||||
assertThat(dbTypeMap.lookup("jsonblob", false).renderType(0, 0)).isEqualTo("varbinary(max)");
|
||||
assertThat(dbTypeMap.lookup("jsonvarchar", false).renderType(200, 0)).isEqualTo("nvarchar(200)");
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,10 @@ public class DbMigrationTest extends BaseTestCase {
|
||||
"migtest_ckey_detail",
|
||||
"migtest_ckey_parent",
|
||||
"migtest_e_basic",
|
||||
"migtest_e_test_binary",
|
||||
"migtest_e_test_varchar",
|
||||
"migtest_e_test_lob",
|
||||
"migtest_e_test_json",
|
||||
"migtest_e_enum",
|
||||
"migtest_e_history",
|
||||
"migtest_e_history2",
|
||||
@@ -83,9 +87,14 @@ public class DbMigrationTest extends BaseTestCase {
|
||||
"`migtest_QuOtEd`",
|
||||
"migtest_QuOtEd",
|
||||
"\"migtest_QuOtEd\"",
|
||||
"drop_main_drop_ref_many",
|
||||
"drop_ref_many",
|
||||
"drop_ref_one",
|
||||
"drop_main",
|
||||
"table",
|
||||
"\"table\"",
|
||||
"`table`");
|
||||
|
||||
((DataSourcePool)server().dataSource()).offline();
|
||||
((DataSourcePool)server().dataSource()).online();
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
The migration dir contains 3 folders `v1_0`, `v1_1`, `v1_2`.
|
||||
|
||||
The general idea is, that we try to perform a migration (=`v1.0` -> `v1.1`) and also if it is revertable (= `v1.1` -> `v1.0`)
|
||||
|
||||
To achieve that, the directories `v1_0` and `v1_2` should be as equal as possible. Annomalies should be commented.
|
||||
|
||||
It is also important, if new models are added, that all table names (also for M2M) are added in the `DbMigrationTest`
|
||||
cleanup routine.
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package misc.migration.v1_0;
|
||||
package misc.migration.v1_1;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
+1
-2
@@ -1,9 +1,8 @@
|
||||
package misc.migration.v1_0;
|
||||
package misc.migration.v1_1;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import java.util.List;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package misc.migration.v1_0;
|
||||
package misc.migration.v1_1;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
@@ -0,0 +1,72 @@
|
||||
package misc.migration.v1_1;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Entity
|
||||
@Table(name = "migtest_e_test_binary")
|
||||
public class ETestBinary {
|
||||
|
||||
@Id
|
||||
int id;
|
||||
|
||||
@Size(max = 16)
|
||||
byte[] test_byte16;
|
||||
|
||||
@Size(max = 256)
|
||||
byte[] test_byte256;
|
||||
|
||||
@Size(max = 512)
|
||||
byte[] test_byte512;
|
||||
|
||||
@Size(max = 1024)
|
||||
byte[] test_byte1k;
|
||||
|
||||
@Size(max = 2 * 1024)
|
||||
byte[] test_byte2k;
|
||||
|
||||
@Size(max = 4 * 1024)
|
||||
byte[] test_byte4k;
|
||||
|
||||
@Size(max = 8 * 1024)
|
||||
byte[] test_byte8k;
|
||||
|
||||
@Size(max = 16 * 1024)
|
||||
byte[] test_byte16k;
|
||||
|
||||
@Size(max = 32 * 1024)
|
||||
byte[] test_byte32k;
|
||||
|
||||
@Size(max = 64 * 1024)
|
||||
byte[] test_byte64k;
|
||||
|
||||
@Size(max = 128 * 1024)
|
||||
byte[] test_byte128k;
|
||||
|
||||
@Size(max = 256 * 1024)
|
||||
byte[] test_byte256k;
|
||||
|
||||
@Size(max = 512 * 1024)
|
||||
byte[] test_byte512k;
|
||||
|
||||
@Size(max = 1024 * 1024)
|
||||
byte[] test_byte1m;
|
||||
|
||||
@Size(max = 2 * 1024 * 1024)
|
||||
byte[] test_byte2m;
|
||||
|
||||
@Size(max = 4 * 1024 * 1024)
|
||||
byte[] test_byte4m;
|
||||
|
||||
@Size(max = 8 * 1024 * 1024)
|
||||
byte[] test_byte8m;
|
||||
|
||||
@Size(max = 16 * 1024 * 1024)
|
||||
byte[] test_byte16m;
|
||||
|
||||
@Size(max = 32 * 1024 * 1024)
|
||||
byte[] test_byte32m;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package misc.migration.v1_1;
|
||||
|
||||
import io.ebean.annotation.DbJson;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "migtest_e_test_json")
|
||||
public class ETestJson {
|
||||
|
||||
@Id
|
||||
int id;
|
||||
|
||||
@DbJson(length = 255)
|
||||
List<String> json255;
|
||||
|
||||
@DbJson(length = 256)
|
||||
List<String> json256;
|
||||
|
||||
@DbJson(length = 512)
|
||||
List<String> json512;
|
||||
|
||||
@DbJson(length = 1024)
|
||||
List<String> json1k;
|
||||
|
||||
@DbJson(length = 2 * 1024)
|
||||
List<String> json2k;
|
||||
|
||||
@DbJson(length = 4 * 1024)
|
||||
List<String> json4k;
|
||||
|
||||
@DbJson(length = 8 * 1024)
|
||||
List<String> json8k;
|
||||
|
||||
@DbJson(length = 16 * 1024)
|
||||
List<String> json16k;
|
||||
|
||||
@DbJson(length = 32 * 1024)
|
||||
List<String> json32k;
|
||||
|
||||
@DbJson(length = 64 * 1024)
|
||||
List<String> json64k;
|
||||
|
||||
@DbJson(length = 128 * 1024)
|
||||
List<String> json128k;
|
||||
|
||||
@DbJson(length = 256 * 1024)
|
||||
List<String> json256k;
|
||||
|
||||
@DbJson(length = 512 * 1024)
|
||||
List<String> json512k;
|
||||
|
||||
@DbJson(length = 1024 * 1024)
|
||||
List<String> json1m;
|
||||
|
||||
@DbJson(length = 2 * 1024 * 1024)
|
||||
List<String> json2m;
|
||||
|
||||
@DbJson(length = 4 * 1024 * 1024)
|
||||
List<String> json4m;
|
||||
|
||||
@DbJson(length = 8 * 1024 * 1024)
|
||||
List<String> json8m;
|
||||
|
||||
@DbJson(length = 16 * 1024 * 1024)
|
||||
List<String> json16m;
|
||||
|
||||
@DbJson(length = 32 * 1024 * 1024)
|
||||
List<String> json32m;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package misc.migration.v1_1;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Entity
|
||||
@Table(name = "migtest_e_test_lob")
|
||||
public class ETestLob {
|
||||
|
||||
@Id
|
||||
int id;
|
||||
|
||||
@Size(max = 255)
|
||||
@Lob
|
||||
String lob255;
|
||||
|
||||
@Size(max = 256)
|
||||
@Lob
|
||||
String lob256;
|
||||
|
||||
@Size(max = 512)
|
||||
@Lob
|
||||
String lob512;
|
||||
|
||||
@Size(max = 1024)
|
||||
@Lob
|
||||
String lob1k;
|
||||
|
||||
@Size(max = 2 * 1024)
|
||||
@Lob
|
||||
String lob2k;
|
||||
|
||||
@Size(max = 4 * 1024)
|
||||
@Lob
|
||||
String lob4k;
|
||||
|
||||
@Size(max = 8 * 1024)
|
||||
@Lob
|
||||
String lob8k;
|
||||
|
||||
@Size(max = 16 * 1024)
|
||||
@Lob
|
||||
String lob16k;
|
||||
|
||||
@Size(max = 32 * 1024)
|
||||
@Lob
|
||||
String lob32k;
|
||||
|
||||
@Size(max = 64 * 1024)
|
||||
@Lob
|
||||
String lob64k;
|
||||
|
||||
@Size(max = 128 * 1024)
|
||||
@Lob
|
||||
String lob128k;
|
||||
|
||||
@Size(max = 256 * 1024)
|
||||
@Lob
|
||||
String lob256k;
|
||||
|
||||
@Size(max = 512 * 1024)
|
||||
@Lob
|
||||
String lob512k;
|
||||
|
||||
@Size(max = 1024 * 1024)
|
||||
@Lob
|
||||
String lob1m;
|
||||
|
||||
@Size(max = 2 * 1024 * 1024)
|
||||
@Lob
|
||||
String lob2m;
|
||||
|
||||
@Size(max = 4 * 1024 * 1024)
|
||||
@Lob
|
||||
String lob4m;
|
||||
|
||||
@Size(max = 8 * 1024 * 1024)
|
||||
@Lob
|
||||
String lob8m;
|
||||
|
||||
@Size(max = 16 * 1024 * 1024)
|
||||
@Lob
|
||||
String lob16m;
|
||||
|
||||
@Size(max = 32 * 1024 * 1024)
|
||||
@Lob
|
||||
String lob32m;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package misc.migration.v1_1;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Entity
|
||||
@Table(name = "migtest_e_test_varchar")
|
||||
public class ETestVarchar {
|
||||
|
||||
@Id
|
||||
int id;
|
||||
|
||||
@Size(max = 255)
|
||||
String varchar255;
|
||||
|
||||
@Size(max = 256)
|
||||
String varchar256;
|
||||
|
||||
@Size(max = 512)
|
||||
String varchar512;
|
||||
|
||||
@Size(max = 1024)
|
||||
String varchar1k;
|
||||
|
||||
@Size(max = 2 * 1024)
|
||||
String varchar2k;
|
||||
|
||||
@Size(max = 4 * 1024)
|
||||
String varchar4k;
|
||||
|
||||
// Override definition for MariaDB
|
||||
@Column(columnDefinition = "mariadb,mysql;varchar(8193);")
|
||||
@Size(max = 8 * 1024)
|
||||
String varchar8k;
|
||||
|
||||
@Size(max = 16 * 1024)
|
||||
String varchar16k;
|
||||
|
||||
@Size(max = 32 * 1024)
|
||||
String varchar32k;
|
||||
|
||||
@Size(max = 64 * 1024)
|
||||
String varchar64k;
|
||||
|
||||
@Size(max = 128 * 1024)
|
||||
String varchar128k;
|
||||
|
||||
@Size(max = 256 * 1024)
|
||||
String varchar256k;
|
||||
|
||||
@Size(max = 512 * 1024)
|
||||
String varchar512k;
|
||||
|
||||
@Size(max = 1024 * 1024)
|
||||
String varchar1m;
|
||||
|
||||
@Size(max = 2 * 1024 * 1024)
|
||||
String varchar2m;
|
||||
|
||||
@Size(max = 4 * 1024 * 1024)
|
||||
String varchar4m;
|
||||
|
||||
@Size(max = 8 * 1024 * 1024)
|
||||
String varchar8m;
|
||||
|
||||
@Size(max = 16 * 1024 * 1024)
|
||||
String varchar16m;
|
||||
|
||||
@Size(max = 32 * 1024 * 1024)
|
||||
String varchar32m;
|
||||
|
||||
}
|
||||
@@ -11,6 +11,10 @@ import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Table(name = "migtest_e_basic")
|
||||
// Note: tablespaces are currently only supported for DB2
|
||||
// to be prepared for future (when we support sql server filegroups),
|
||||
// we allow to specify the DB-platform here
|
||||
@Tablespace(value = "db2;TSTABLES;", index = "db2;INDEXTS;")
|
||||
public class EBasic {
|
||||
|
||||
public enum Status {
|
||||
@@ -86,7 +90,7 @@ public class EBasic {
|
||||
String indextest6;
|
||||
|
||||
@NotNull
|
||||
@DbDefault("23")
|
||||
@DbDefault("23") // required for revert
|
||||
int user_id;
|
||||
|
||||
public EBasic() {
|
||||
|
||||
@@ -21,6 +21,6 @@ public class EHistory6 {
|
||||
Integer testNumber1;
|
||||
|
||||
@NotNull
|
||||
@DbDefault("7")
|
||||
@DbDefault("7") // required for revert
|
||||
Integer testNumber2;
|
||||
}
|
||||
|
||||
@@ -45,4 +45,13 @@ public class ETable {
|
||||
|
||||
@OneToMany(mappedBy = "foreign")
|
||||
List<ETable> foreigns;
|
||||
|
||||
// @NotNull
|
||||
// @DbDefault("")
|
||||
// private String textfield;
|
||||
// FIXME: MariaDb produces an invalid quoted statement. We would need to fix quotes here.
|
||||
// but using reserved names for tables is a bad idea IMHO
|
||||
// actual: update "table" set textfield = '' where textfield is null;
|
||||
// expected: update `table` set textfield = '' where textfield is null;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package org.tests.basic;
|
||||
|
||||
import io.ebean.DB;
|
||||
import io.ebean.DataIntegrityException;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.json.EBasicJsonList;
|
||||
import org.tests.model.json.EBasicJsonMap;
|
||||
import org.tests.model.types.SomeFileBean;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
/**
|
||||
* @author Roland Praml, FOCONIS AG
|
||||
*/
|
||||
public class TestLength extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
void testFileSize() throws IOException {
|
||||
File f1 = File.createTempFile("testfile", "tmp");
|
||||
byte[] buf = new byte[1024];
|
||||
try (FileOutputStream fos = new FileOutputStream(f1)) {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
fos.write(buf);
|
||||
}
|
||||
}
|
||||
|
||||
SomeFileBean sfb1 = new SomeFileBean();
|
||||
sfb1.setContent(f1);
|
||||
DB.save(sfb1);
|
||||
|
||||
try (FileOutputStream fos = new FileOutputStream(f1)) {
|
||||
for (int i = 0; i < 101; i++) {
|
||||
fos.write(buf);
|
||||
}
|
||||
}
|
||||
|
||||
SomeFileBean sfb2 = new SomeFileBean();
|
||||
sfb2.setContent(f1);
|
||||
assertThatThrownBy(() -> DB.save(sfb2)).isInstanceOf(DataIntegrityException.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The property 'EBasicJsonMap.content' is annotated with @DbJson(length=5000). So we assume, that we cannot save Json-objects
|
||||
* where the serialized form exceed that limit and we would expect an error on save.
|
||||
* The length check works for platforms like h2, as H2 uses a 'varchar(5000)'. So it is impossible to save such long jsons,
|
||||
* but it won't work for SqlServer, as here 'nvarchar(max)' is used. No validation happens at DB level and you might get very
|
||||
* large Json objects in your database. This mostly happens unintentionally (programming error, misconfiguration)
|
||||
* So they are in the database and they cannot be accessed by ebean any more, because there are new limits in Jackson:
|
||||
* - Max 5 Meg per string in 2.15.0
|
||||
* - Max 20 Meg per string in 2.15.1
|
||||
* see https://github.com/FasterXML/jackson-core/issues/1014
|
||||
*/
|
||||
@Test
|
||||
void testLongString() {
|
||||
// s is so big, that it could not be deserialized by jackson
|
||||
String s = new String(new char[20_000_001]).replace('\0', 'x');
|
||||
|
||||
EBasicJsonMap bean = new EBasicJsonMap();
|
||||
bean.setName("b1");
|
||||
bean.setContent(Map.of("string", s));
|
||||
|
||||
assertThatThrownBy(() -> {
|
||||
// we expect, that we can NOT save the bean, this is ensured by the bind validator.
|
||||
DB.save(bean);
|
||||
}).isInstanceOf(DataIntegrityException.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests the UTF8 validation.
|
||||
*/
|
||||
@Test
|
||||
void testUtf8() {
|
||||
|
||||
String s = new String(new char[40]).replace('\0', '€');
|
||||
|
||||
EBasicJsonList bean = new EBasicJsonList();
|
||||
bean.setName("b1");
|
||||
bean.setTags(List.of(s));
|
||||
|
||||
if (isDb2() || isOracle()) {
|
||||
// by default, DB2 && oracle uses bytes in varchar, so an '€' symbol needs 3 bytes
|
||||
assertThatThrownBy(() -> {
|
||||
// we expect, that we can NOT save the bean, this is ensured by the bind validator.
|
||||
DB.save(bean);
|
||||
}).isInstanceOf(DataIntegrityException.class);
|
||||
} else {
|
||||
DB.save(bean);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.tests.json;
|
||||
|
||||
import io.ebean.DB;
|
||||
import io.ebean.DataIntegrityException;
|
||||
import org.assertj.core.api.SoftAssertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.json.EBasicJsonMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
class TestDbJsonLength {
|
||||
|
||||
|
||||
/**
|
||||
* The property 'EBasicJsonMap.content' is annotated with @DbJson(length=5000). So we assume, that we cannot save Json-objects
|
||||
* where the serialized form exceed that limit and we would expect an error on save.
|
||||
* The length check works for platforms like h2, as H2 uses a 'varchar(5000)'. So it is impossible to save such long jsons,
|
||||
* but it won't work for SqlServer, as here 'nvarchar(max)' is used. No validation happens at DB level and you might get very
|
||||
* large Json objects in your database. This mostly happens unintentionally (programming error, misconfiguration)
|
||||
* So they are in the database and they cannot be accessed by ebean any more, because there are new limits in Jackson:
|
||||
* - Max 5 Meg per string in 2.15.0
|
||||
* - Max 20 Meg per string in 2.15.1
|
||||
* see https://github.com/FasterXML/jackson-core/issues/1014
|
||||
*/
|
||||
@Test
|
||||
void testLongString() {
|
||||
// s is so big, that it could not be deserialized by jackson
|
||||
String s = new String(new char[20_000_001]).replace('\0', 'x');
|
||||
|
||||
EBasicJsonMap bean = new EBasicJsonMap();
|
||||
bean.setName("b1");
|
||||
bean.setContent(Map.of("string", s));
|
||||
|
||||
SoftAssertions softly = new SoftAssertions();
|
||||
|
||||
softly.assertThatThrownBy(() -> {
|
||||
DB.save(bean);
|
||||
}).isInstanceOf(DataIntegrityException.class);
|
||||
|
||||
|
||||
if (bean.getId() != null) {
|
||||
// we expect, that we could NOT save the bean, but this is not true for sqlServer.
|
||||
// we will get a javax.persistence.PersistenceException: Error loading on org.tests.model.json.EBasicJsonMap.content
|
||||
// when we try to load the bean back from DB
|
||||
DB.find(EBasicJsonMap.class, bean.getId());
|
||||
}
|
||||
|
||||
softly.assertAll();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
package org.tests.m2m;
|
||||
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import io.ebean.DB;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.model.basic.MRole;
|
||||
import org.tests.model.basic.MUser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -52,4 +53,27 @@ public class TestM2MModifyTest extends BaseTestCase {
|
||||
roles = u0.getRoles();
|
||||
assertThat(roles).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test1() {
|
||||
List<MRole> roles = new ArrayList<>();
|
||||
for (int i = 0; i < 56; i++) {
|
||||
MRole r0 = new MRole("mrole" + i);
|
||||
roles.add(r0);
|
||||
}
|
||||
|
||||
DB.saveAll(roles);
|
||||
|
||||
MUser u0 = new MUser("usr0");
|
||||
u0.getRoles().addAll(roles);
|
||||
|
||||
DB.save(u0);
|
||||
|
||||
u0 = DB.find(MUser.class, u0.getUserid());
|
||||
|
||||
u0.getRoles().clear();
|
||||
u0.getRoles().addAll(roles);
|
||||
|
||||
DB.save(u0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,12 @@ import io.ebean.annotation.Cache;
|
||||
|
||||
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
|
||||
|
||||
@@ -18,7 +18,7 @@ public class EBasicJsonMap {
|
||||
|
||||
String name;
|
||||
|
||||
@DbJson
|
||||
@DbJson(length = 5000)
|
||||
Map<String, Object> content;
|
||||
|
||||
@OneToMany(mappedBy = "owner", cascade = CascadeType.ALL)
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package org.tests.model.types;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.Version;
|
||||
import javax.persistence.*;
|
||||
import java.io.File;
|
||||
|
||||
@Entity
|
||||
@@ -18,6 +15,7 @@ public class SomeFileBean {
|
||||
String name;
|
||||
|
||||
@Lob
|
||||
@Column(length = 100 * 1024) // limit to 100kb
|
||||
File content;
|
||||
|
||||
public Long getId() {
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.tests.query;
|
||||
|
||||
import io.ebean.DB;
|
||||
import io.ebean.Transaction;
|
||||
import io.ebean.xtest.BaseTestCase;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.tests.m2m.softdelete.MsManyA;
|
||||
import org.tests.m2m.softdelete.MsManyB;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestQueryFindEachHeapPressure extends BaseTestCase {
|
||||
|
||||
private byte[] buffer;
|
||||
|
||||
@BeforeEach
|
||||
public void before() {
|
||||
DB.find(MsManyB.class).delete();
|
||||
DB.find(MsManyA.class).delete();
|
||||
|
||||
List<MsManyB> children = new ArrayList<>();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
children.add(new MsManyB("child_" + i));
|
||||
}
|
||||
DB.saveAll(children);
|
||||
|
||||
try (Transaction txn = DB.beginTransaction()) {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
MsManyA parent = new MsManyA("parent_" + i);
|
||||
|
||||
Collections.shuffle(children);
|
||||
|
||||
parent.getManybs().add(children.get(0));
|
||||
|
||||
DB.save(parent);
|
||||
}
|
||||
txn.commit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reproduce quickly, by manually adding System.gc at the beginning of CQuery#setLazyLoadedChildBean.
|
||||
*/
|
||||
@Test
|
||||
@Disabled("Run manually with -Xmx128M")
|
||||
public void test() throws Exception {
|
||||
for (int j = 0; j < 1000; j++) {
|
||||
System.out.println("Iteration " + j);
|
||||
DB.find(MsManyA.class)
|
||||
.findEach(parent -> {
|
||||
if (Math.random() > 0.9) {
|
||||
buffer = new byte[1_000_000];
|
||||
List<MsManyB> children = parent.getManybs();
|
||||
assertThat(children.size()).isEqualTo(1);
|
||||
assertThat(buffer.length).isEqualTo(1_000_000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,24 +45,6 @@ create table migtest_fk_set_null (
|
||||
one_id UInt64
|
||||
) ENGINE = Log();
|
||||
|
||||
create table drop_main (
|
||||
id UInt32
|
||||
) ENGINE = Log();
|
||||
|
||||
create table drop_main_drop_ref_many (
|
||||
drop_main_id UInt32,
|
||||
drop_ref_many_id UInt32
|
||||
) ENGINE = Log();
|
||||
|
||||
create table drop_ref_many (
|
||||
id UInt32
|
||||
) ENGINE = Log();
|
||||
|
||||
create table drop_ref_one (
|
||||
id UInt32,
|
||||
parent_id UInt32
|
||||
) ENGINE = Log();
|
||||
|
||||
create table migtest_e_basic (
|
||||
id UInt32,
|
||||
status String,
|
||||
|
||||
@@ -6,6 +6,116 @@ alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest2;
|
||||
alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest6;
|
||||
alter table migtest_e_enum drop constraint if exists ck_migtest_e_enum_test_status;
|
||||
-- apply changes
|
||||
create table drop_main (
|
||||
id UInt32
|
||||
) ENGINE = Log();
|
||||
|
||||
create table drop_main_drop_ref_many (
|
||||
drop_main_id UInt32,
|
||||
drop_ref_many_id UInt32
|
||||
) ENGINE = Log();
|
||||
|
||||
create table drop_ref_many (
|
||||
id UInt32
|
||||
) ENGINE = Log();
|
||||
|
||||
create table drop_ref_one (
|
||||
id UInt32,
|
||||
parent_id UInt32
|
||||
) ENGINE = Log();
|
||||
|
||||
create table migtest_e_test_binary (
|
||||
id UInt32,
|
||||
test_byte16 String,
|
||||
test_byte256 String,
|
||||
test_byte512 String,
|
||||
test_byte1k String,
|
||||
test_byte2k String,
|
||||
test_byte4k String,
|
||||
test_byte8k String,
|
||||
test_byte16k String,
|
||||
test_byte32k String,
|
||||
test_byte64k String,
|
||||
test_byte128k String,
|
||||
test_byte256k String,
|
||||
test_byte512k String,
|
||||
test_byte1m String,
|
||||
test_byte2m String,
|
||||
test_byte4m String,
|
||||
test_byte8m String,
|
||||
test_byte16m String,
|
||||
test_byte32m String
|
||||
) ENGINE = Log();
|
||||
|
||||
create table migtest_e_test_json (
|
||||
id UInt32,
|
||||
json255 String,
|
||||
json256 String,
|
||||
json512 String,
|
||||
json1k String,
|
||||
json2k String,
|
||||
json4k String,
|
||||
json8k String,
|
||||
json16k String,
|
||||
json32k String,
|
||||
json64k String,
|
||||
json128k String,
|
||||
json256k String,
|
||||
json512k String,
|
||||
json1m String,
|
||||
json2m String,
|
||||
json4m String,
|
||||
json8m String,
|
||||
json16m String,
|
||||
json32m String
|
||||
) ENGINE = Log();
|
||||
|
||||
create table migtest_e_test_lob (
|
||||
id UInt32,
|
||||
lob255 String,
|
||||
lob256 String,
|
||||
lob512 String,
|
||||
lob1k String,
|
||||
lob2k String,
|
||||
lob4k String,
|
||||
lob8k String,
|
||||
lob16k String,
|
||||
lob32k String,
|
||||
lob64k String,
|
||||
lob128k String,
|
||||
lob256k String,
|
||||
lob512k String,
|
||||
lob1m String,
|
||||
lob2m String,
|
||||
lob4m String,
|
||||
lob8m String,
|
||||
lob16m String,
|
||||
lob32m String
|
||||
) ENGINE = Log();
|
||||
|
||||
create table migtest_e_test_varchar (
|
||||
id UInt32,
|
||||
varchar255 String,
|
||||
varchar256 String,
|
||||
varchar512 String,
|
||||
varchar1k String,
|
||||
varchar2k String,
|
||||
varchar4k String,
|
||||
varchar8k String,
|
||||
varchar16k String,
|
||||
varchar32k String,
|
||||
varchar64k String,
|
||||
varchar128k String,
|
||||
varchar256k String,
|
||||
varchar512k String,
|
||||
varchar1m String,
|
||||
varchar2m String,
|
||||
varchar4m String,
|
||||
varchar8m String,
|
||||
varchar16m String,
|
||||
varchar32m String
|
||||
) ENGINE = Log();
|
||||
|
||||
create table migtest_e_user (
|
||||
id UInt32
|
||||
) ENGINE = Log();
|
||||
|
||||
-4
@@ -7,9 +7,5 @@ alter table migtest_e_basic drop column eref_id;
|
||||
alter table migtest_e_history2 drop column obsolete_string1;
|
||||
alter table migtest_e_history2 drop column obsolete_string2;
|
||||
-- apply post alter
|
||||
drop table if exists drop_main;
|
||||
drop table if exists drop_main_drop_ref_many;
|
||||
drop table if exists drop_ref_many;
|
||||
drop table if exists drop_ref_one;
|
||||
drop table if exists "migtest_QuOtEd";
|
||||
drop table if exists migtest_e_ref;
|
||||
|
||||
+8
@@ -17,6 +17,14 @@ alter table migtest_e_history5 drop column test_boolean;
|
||||
alter table migtest_e_softdelete drop column deleted;
|
||||
alter table migtest_oto_child drop column master_id;
|
||||
-- apply post alter
|
||||
drop table if exists drop_main;
|
||||
drop table if exists drop_main_drop_ref_many;
|
||||
drop table if exists drop_ref_many;
|
||||
drop table if exists drop_ref_one;
|
||||
drop table if exists migtest_e_test_binary;
|
||||
drop table if exists migtest_e_test_json;
|
||||
drop table if exists migtest_e_test_lob;
|
||||
drop table if exists migtest_e_test_varchar;
|
||||
drop table if exists migtest_e_user;
|
||||
drop table if exists migtest_mtm_c_migtest_mtm_m;
|
||||
drop table if exists migtest_mtm_m_migtest_mtm_c;
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
1672735407, 1.0__initial.sql
|
||||
540706946, 1.1.sql
|
||||
-875723380, 1.2__dropsFor_1.1.sql
|
||||
193400547, 1.0__initial.sql
|
||||
1036221356, 1.1.sql
|
||||
688811494, 1.2__dropsFor_1.1.sql
|
||||
1015552567, 1.3.sql
|
||||
255653518, 1.4__dropsFor_1.3.sql
|
||||
-252580551, 1.4__dropsFor_1.3.sql
|
||||
|
||||
|
||||
@@ -54,28 +54,6 @@ create table migtest_fk_set_null (
|
||||
constraint pk_migtest_fk_set_null primary key (id)
|
||||
);
|
||||
|
||||
create table drop_main (
|
||||
id integer generated by default as identity not null,
|
||||
constraint pk_drop_main primary key (id)
|
||||
);
|
||||
|
||||
create table drop_main_drop_ref_many (
|
||||
drop_main_id integer not null,
|
||||
drop_ref_many_id integer not null,
|
||||
constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id)
|
||||
);
|
||||
|
||||
create table drop_ref_many (
|
||||
id integer generated by default as identity not null,
|
||||
constraint pk_drop_ref_many primary key (id)
|
||||
);
|
||||
|
||||
create table drop_ref_one (
|
||||
id integer generated by default as identity not null,
|
||||
parent_id integer,
|
||||
constraint pk_drop_ref_one primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_basic (
|
||||
id integer generated by default as identity not null,
|
||||
status varchar(1),
|
||||
@@ -215,15 +193,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei
|
||||
create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id);
|
||||
alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict;
|
||||
|
||||
create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id);
|
||||
alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id);
|
||||
alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict;
|
||||
|
||||
|
||||
@@ -7,13 +7,128 @@ alter table migtest_e_basic drop constraint if exists ck_migtest_e_basic_status2
|
||||
drop index uq_migtest_e_basic_indextest2 cascade;
|
||||
drop index uq_migtest_e_basic_indextest6 cascade;
|
||||
alter table migtest_e_enum drop constraint if exists ck_migtest_e_enum_test_status;
|
||||
alter table if exists drop_main_drop_ref_many drop constraint if exists fk_drop_main_drop_ref_many_drop_main;
|
||||
alter table if exists drop_main_drop_ref_many drop constraint if exists fk_drop_main_drop_ref_many_drop_ref_many;
|
||||
alter table if exists drop_ref_one drop constraint if exists fk_drop_ref_one_parent_id;
|
||||
drop index if exists ix_migtest_e_basic_indextest1;
|
||||
drop index if exists ix_migtest_e_basic_indextest5;
|
||||
drop index if exists ix_migtest_quoted_status1;
|
||||
-- apply changes
|
||||
create table drop_main (
|
||||
id integer generated by default as identity not null,
|
||||
constraint pk_drop_main primary key (id)
|
||||
);
|
||||
|
||||
create table drop_main_drop_ref_many (
|
||||
drop_main_id integer not null,
|
||||
drop_ref_many_id integer not null,
|
||||
constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id)
|
||||
);
|
||||
|
||||
create table drop_ref_many (
|
||||
id integer generated by default as identity not null,
|
||||
constraint pk_drop_ref_many primary key (id)
|
||||
);
|
||||
|
||||
create table drop_ref_one (
|
||||
id integer generated by default as identity not null,
|
||||
parent_id integer,
|
||||
constraint pk_drop_ref_one primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_binary (
|
||||
id integer generated by default as identity not null,
|
||||
test_byte16 bytea,
|
||||
test_byte256 bytea,
|
||||
test_byte512 bytea,
|
||||
test_byte1k bytea,
|
||||
test_byte2k bytea,
|
||||
test_byte4k bytea,
|
||||
test_byte8k bytea,
|
||||
test_byte16k bytea,
|
||||
test_byte32k bytea,
|
||||
test_byte64k bytea,
|
||||
test_byte128k bytea,
|
||||
test_byte256k bytea,
|
||||
test_byte512k bytea,
|
||||
test_byte1m bytea,
|
||||
test_byte2m bytea,
|
||||
test_byte4m bytea,
|
||||
test_byte8m bytea,
|
||||
test_byte16m bytea,
|
||||
test_byte32m bytea,
|
||||
constraint pk_migtest_e_test_binary primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_json (
|
||||
id integer generated by default as identity not null,
|
||||
json255 json,
|
||||
json256 json,
|
||||
json512 json,
|
||||
json1k json,
|
||||
json2k json,
|
||||
json4k json,
|
||||
json8k json,
|
||||
json16k json,
|
||||
json32k json,
|
||||
json64k json,
|
||||
json128k json,
|
||||
json256k json,
|
||||
json512k json,
|
||||
json1m json,
|
||||
json2m json,
|
||||
json4m json,
|
||||
json8m json,
|
||||
json16m json,
|
||||
json32m json,
|
||||
constraint pk_migtest_e_test_json primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_lob (
|
||||
id integer generated by default as identity not null,
|
||||
lob255 text,
|
||||
lob256 text,
|
||||
lob512 text,
|
||||
lob1k text,
|
||||
lob2k text,
|
||||
lob4k text,
|
||||
lob8k text,
|
||||
lob16k text,
|
||||
lob32k text,
|
||||
lob64k text,
|
||||
lob128k text,
|
||||
lob256k text,
|
||||
lob512k text,
|
||||
lob1m text,
|
||||
lob2m text,
|
||||
lob4m text,
|
||||
lob8m text,
|
||||
lob16m text,
|
||||
lob32m text,
|
||||
constraint pk_migtest_e_test_lob primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_varchar (
|
||||
id integer generated by default as identity not null,
|
||||
varchar255 varchar(255),
|
||||
varchar256 varchar(256),
|
||||
varchar512 varchar(512),
|
||||
varchar1k varchar(1024),
|
||||
varchar2k varchar(2048),
|
||||
varchar4k varchar(4096),
|
||||
varchar8k varchar(8192),
|
||||
varchar16k varchar(16384),
|
||||
varchar32k varchar(32768),
|
||||
varchar64k varchar(65536),
|
||||
varchar128k varchar(131072),
|
||||
varchar256k varchar(262144),
|
||||
varchar512k varchar(524288),
|
||||
varchar1m varchar(1048576),
|
||||
varchar2m varchar(2097152),
|
||||
varchar4m varchar(4194304),
|
||||
varchar8m varchar(8388608),
|
||||
varchar16m text,
|
||||
varchar32m text,
|
||||
constraint pk_migtest_e_test_varchar primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_user (
|
||||
id integer generated by default as identity not null,
|
||||
constraint pk_migtest_e_user primary key (id)
|
||||
@@ -93,6 +208,15 @@ alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest4 unique
|
||||
alter table migtest_e_basic add constraint uq_migtest_e_basic_indextest5 unique (indextest5);
|
||||
alter table "table" add constraint uq_table_select unique ("select");
|
||||
-- foreign keys and indices
|
||||
create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id);
|
||||
alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id);
|
||||
alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict;
|
||||
|
||||
|
||||
-7
@@ -7,13 +7,6 @@ alter table migtest_e_basic drop column eref_id;
|
||||
alter table migtest_e_history2 drop column obsolete_string1;
|
||||
alter table migtest_e_history2 drop column obsolete_string2;
|
||||
-- apply post alter
|
||||
drop table if exists drop_main cascade;
|
||||
drop sequence if exists drop_main_seq;
|
||||
drop table if exists drop_main_drop_ref_many cascade;
|
||||
drop table if exists drop_ref_many cascade;
|
||||
drop sequence if exists drop_ref_many_seq;
|
||||
drop table if exists drop_ref_one cascade;
|
||||
drop sequence if exists drop_ref_one_seq;
|
||||
drop table if exists "migtest_QuOtEd" cascade;
|
||||
drop table if exists migtest_e_ref cascade;
|
||||
drop sequence if exists migtest_e_ref_seq;
|
||||
|
||||
@@ -14,6 +14,9 @@ drop index uq_migtest_e_basic_name cascade;
|
||||
drop index uq_migtest_e_basic_indextest4 cascade;
|
||||
drop index uq_migtest_e_basic_indextest5 cascade;
|
||||
alter table migtest_e_enum drop constraint if exists ck_migtest_e_enum_test_status;
|
||||
alter table if exists drop_main_drop_ref_many drop constraint if exists fk_drop_main_drop_ref_many_drop_main;
|
||||
alter table if exists drop_main_drop_ref_many drop constraint if exists fk_drop_main_drop_ref_many_drop_ref_many;
|
||||
alter table if exists drop_ref_one drop constraint if exists fk_drop_ref_one_parent_id;
|
||||
alter table if exists migtest_mtm_c_migtest_mtm_m drop constraint if exists fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c;
|
||||
alter table if exists migtest_mtm_c_migtest_mtm_m drop constraint if exists fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m;
|
||||
alter table if exists migtest_mtm_m_migtest_mtm_c drop constraint if exists fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m;
|
||||
|
||||
+15
@@ -17,6 +17,21 @@ alter table migtest_e_history5 drop column test_boolean;
|
||||
alter table migtest_e_softdelete drop column deleted;
|
||||
alter table migtest_oto_child drop column master_id;
|
||||
-- apply post alter
|
||||
drop table if exists drop_main cascade;
|
||||
drop sequence if exists drop_main_seq;
|
||||
drop table if exists drop_main_drop_ref_many cascade;
|
||||
drop table if exists drop_ref_many cascade;
|
||||
drop sequence if exists drop_ref_many_seq;
|
||||
drop table if exists drop_ref_one cascade;
|
||||
drop sequence if exists drop_ref_one_seq;
|
||||
drop table if exists migtest_e_test_binary cascade;
|
||||
drop sequence if exists migtest_e_test_binary_seq;
|
||||
drop table if exists migtest_e_test_json cascade;
|
||||
drop sequence if exists migtest_e_test_json_seq;
|
||||
drop table if exists migtest_e_test_lob cascade;
|
||||
drop sequence if exists migtest_e_test_lob_seq;
|
||||
drop table if exists migtest_e_test_varchar cascade;
|
||||
drop sequence if exists migtest_e_test_varchar_seq;
|
||||
drop table if exists migtest_e_user cascade;
|
||||
drop sequence if exists migtest_e_user_seq;
|
||||
drop table if exists migtest_mtm_c_migtest_mtm_m cascade;
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
1867456246, 1.0__initial.sql
|
||||
-412570267, 1.1.sql
|
||||
395394572, 1.2__dropsFor_1.1.sql
|
||||
-861259583, 1.3.sql
|
||||
-971909974, 1.4__dropsFor_1.3.sql
|
||||
1434934404, 1.0__initial.sql
|
||||
-1445091875, 1.1.sql
|
||||
856096334, 1.2__dropsFor_1.1.sql
|
||||
-279468991, 1.3.sql
|
||||
-1398154763, 1.4__dropsFor_1.3.sql
|
||||
561281075, R__order_views.sql
|
||||
|
||||
|
||||
@@ -54,28 +54,6 @@ create table migtest_fk_set_null (
|
||||
constraint pk_migtest_fk_set_null primary key (id)
|
||||
);
|
||||
|
||||
create table drop_main (
|
||||
id integer generated by default as identity not null,
|
||||
constraint pk_drop_main primary key (id)
|
||||
);
|
||||
|
||||
create table drop_main_drop_ref_many (
|
||||
drop_main_id integer not null,
|
||||
drop_ref_many_id integer not null,
|
||||
constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id)
|
||||
);
|
||||
|
||||
create table drop_ref_many (
|
||||
id integer generated by default as identity not null,
|
||||
constraint pk_drop_ref_many primary key (id)
|
||||
);
|
||||
|
||||
create table drop_ref_one (
|
||||
id integer generated by default as identity not null,
|
||||
parent_id integer,
|
||||
constraint pk_drop_ref_one primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_basic (
|
||||
id integer generated by default as identity not null,
|
||||
status varchar(1),
|
||||
@@ -254,15 +232,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei
|
||||
create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id);
|
||||
alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict;
|
||||
|
||||
create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id);
|
||||
alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id);
|
||||
alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict;
|
||||
|
||||
|
||||
@@ -65,27 +65,6 @@ end if;
|
||||
end$$;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select constname from syscat.tabconst where tabschema = current_schema and ucase(constname) = 'FK_DROP_MAIN_DROP_REF_MANY_DROP_MAIN' and ucase(tabname) = 'DROP_MAIN_DROP_REF_MANY') then
|
||||
prepare stmt from 'alter table drop_main_drop_ref_many drop constraint fk_drop_main_drop_ref_many_drop_main';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select constname from syscat.tabconst where tabschema = current_schema and ucase(constname) = 'FK_DROP_MAIN_DROP_REF_MANY_DROP_REF_MANY' and ucase(tabname) = 'DROP_MAIN_DROP_REF_MANY') then
|
||||
prepare stmt from 'alter table drop_main_drop_ref_many drop constraint fk_drop_main_drop_ref_many_drop_ref_many';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select constname from syscat.tabconst where tabschema = current_schema and ucase(constname) = 'FK_DROP_REF_ONE_PARENT_ID' and ucase(tabname) = 'DROP_REF_ONE') then
|
||||
prepare stmt from 'alter table drop_ref_one drop constraint fk_drop_ref_one_parent_id';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select indname from syscat.indexes where indschema = current_schema and ucase(indname) = 'IX_MIGTEST_E_BASIC_INDEXTEST1') then
|
||||
prepare stmt from 'drop index ix_migtest_e_basic_indextest1';
|
||||
execute stmt;
|
||||
@@ -106,6 +85,124 @@ if exists (select indname from syscat.indexes where indschema = current_schema a
|
||||
end if;
|
||||
end$$;
|
||||
-- apply changes
|
||||
create table drop_main (
|
||||
id integer generated by default as identity not null,
|
||||
constraint pk_drop_main primary key (id)
|
||||
);
|
||||
|
||||
create table drop_main_drop_ref_many (
|
||||
drop_main_id integer not null,
|
||||
drop_ref_many_id integer not null,
|
||||
constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id)
|
||||
);
|
||||
|
||||
create table drop_ref_many (
|
||||
id integer generated by default as identity not null,
|
||||
constraint pk_drop_ref_many primary key (id)
|
||||
);
|
||||
|
||||
create table drop_ref_one (
|
||||
id integer generated by default as identity not null,
|
||||
parent_id integer,
|
||||
constraint pk_drop_ref_one primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_binary (
|
||||
id integer generated by default as identity not null,
|
||||
test_byte16 varbinary(16),
|
||||
test_byte256 varbinary(256),
|
||||
test_byte512 varbinary(512),
|
||||
test_byte1k varbinary(1024),
|
||||
test_byte2k varbinary(2048),
|
||||
test_byte4k varbinary(4096),
|
||||
test_byte8k blob(8192),
|
||||
test_byte16k blob(16384),
|
||||
test_byte32k blob(32768),
|
||||
test_byte64k blob(65536),
|
||||
test_byte128k blob(131072),
|
||||
test_byte256k blob(262144),
|
||||
test_byte512k blob(524288),
|
||||
test_byte1m blob(1048576),
|
||||
test_byte2m blob(2097152),
|
||||
test_byte4m blob(4194304),
|
||||
test_byte8m blob(8388608),
|
||||
test_byte16m blob(16777216),
|
||||
test_byte32m blob(33554432),
|
||||
constraint pk_migtest_e_test_binary primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_json (
|
||||
id integer generated by default as identity not null,
|
||||
json255 varchar(255),
|
||||
json256 varchar(256),
|
||||
json512 varchar(512),
|
||||
json1k varchar(1024),
|
||||
json2k varchar(2048),
|
||||
json4k clob(4096),
|
||||
json8k clob(8192),
|
||||
json16k clob(16384),
|
||||
json32k clob(32768),
|
||||
json64k clob(65536),
|
||||
json128k clob(131072),
|
||||
json256k clob(262144),
|
||||
json512k clob(524288),
|
||||
json1m clob(1048576),
|
||||
json2m clob(2097152),
|
||||
json4m clob(4194304),
|
||||
json8m clob(8388608),
|
||||
json16m clob(16777216),
|
||||
json32m clob(33554432),
|
||||
constraint pk_migtest_e_test_json primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_lob (
|
||||
id integer generated by default as identity not null,
|
||||
lob255 clob,
|
||||
lob256 clob,
|
||||
lob512 clob,
|
||||
lob1k clob,
|
||||
lob2k clob,
|
||||
lob4k clob,
|
||||
lob8k clob,
|
||||
lob16k clob,
|
||||
lob32k clob,
|
||||
lob64k clob,
|
||||
lob128k clob,
|
||||
lob256k clob,
|
||||
lob512k clob,
|
||||
lob1m clob,
|
||||
lob2m clob,
|
||||
lob4m clob,
|
||||
lob8m clob,
|
||||
lob16m clob,
|
||||
lob32m clob,
|
||||
constraint pk_migtest_e_test_lob primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_varchar (
|
||||
id integer generated by default as identity not null,
|
||||
varchar255 varchar(255),
|
||||
varchar256 varchar(256),
|
||||
varchar512 varchar(512),
|
||||
varchar1k varchar(1024),
|
||||
varchar2k varchar(2048),
|
||||
varchar4k clob(4096),
|
||||
varchar8k clob(8192),
|
||||
varchar16k clob(16384),
|
||||
varchar32k clob(32768),
|
||||
varchar64k clob(65536),
|
||||
varchar128k clob(131072),
|
||||
varchar256k clob(262144),
|
||||
varchar512k clob(524288),
|
||||
varchar1m clob(1048576),
|
||||
varchar2m clob(2097152),
|
||||
varchar4m clob(4194304),
|
||||
varchar8m clob(8388608),
|
||||
varchar16m clob(16777216),
|
||||
varchar32m clob(33554432),
|
||||
constraint pk_migtest_e_test_varchar primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_user (
|
||||
id integer generated by default as identity not null,
|
||||
constraint pk_migtest_e_user primary key (id)
|
||||
@@ -231,6 +328,15 @@ comment on column "table"."index" is 'this is an other comment';
|
||||
alter table "table" add versioning use history table table_history;
|
||||
create unique index uq_table_select on "table"("select") exclude null keys;
|
||||
-- foreign keys and indices
|
||||
create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id);
|
||||
alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id);
|
||||
alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict;
|
||||
|
||||
|
||||
@@ -15,31 +15,6 @@ alter table migtest_e_history2_history drop column obsolete_string2;
|
||||
call sysproc.admin_cmd('reorg table migtest_e_history2_history');
|
||||
-- apply post alter
|
||||
alter table migtest_e_history2 add versioning use history table migtest_e_history2_history;
|
||||
drop table drop_main;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'DROP_MAIN_SEQ') then
|
||||
prepare stmt from 'drop sequence drop_main_seq';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
drop table drop_main_drop_ref_many;
|
||||
drop table drop_ref_many;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'DROP_REF_MANY_SEQ') then
|
||||
prepare stmt from 'drop sequence drop_ref_many_seq';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
drop table drop_ref_one;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'DROP_REF_ONE_SEQ') then
|
||||
prepare stmt from 'drop sequence drop_ref_one_seq';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
drop table "migtest_QuOtEd";
|
||||
drop table migtest_e_ref;
|
||||
delimiter $$
|
||||
|
||||
@@ -135,6 +135,27 @@ end if;
|
||||
end$$;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select constname from syscat.tabconst where tabschema = current_schema and ucase(constname) = 'FK_DROP_MAIN_DROP_REF_MANY_DROP_MAIN' and ucase(tabname) = 'DROP_MAIN_DROP_REF_MANY') then
|
||||
prepare stmt from 'alter table drop_main_drop_ref_many drop constraint fk_drop_main_drop_ref_many_drop_main';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select constname from syscat.tabconst where tabschema = current_schema and ucase(constname) = 'FK_DROP_MAIN_DROP_REF_MANY_DROP_REF_MANY' and ucase(tabname) = 'DROP_MAIN_DROP_REF_MANY') then
|
||||
prepare stmt from 'alter table drop_main_drop_ref_many drop constraint fk_drop_main_drop_ref_many_drop_ref_many';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select constname from syscat.tabconst where tabschema = current_schema and ucase(constname) = 'FK_DROP_REF_ONE_PARENT_ID' and ucase(tabname) = 'DROP_REF_ONE') then
|
||||
prepare stmt from 'alter table drop_ref_one drop constraint fk_drop_ref_one_parent_id';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select constname from syscat.tabconst where tabschema = current_schema and ucase(constname) = 'FK_MIGTEST_MTM_C_MIGTEST_MTM_M_MIGTEST_MTM_C' and ucase(tabname) = 'MIGTEST_MTM_C_MIGTEST_MTM_M') then
|
||||
prepare stmt from 'alter table migtest_mtm_c_migtest_mtm_m drop constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c';
|
||||
execute stmt;
|
||||
@@ -211,6 +232,7 @@ update migtest_e_basic set status2 = 'N' where status2 is null;
|
||||
update migtest_e_basic set a_lob = 'X' where a_lob is null;
|
||||
|
||||
update migtest_e_basic set user_id = 23 where user_id is null;
|
||||
CALL SYSPROC.ADMIN_MOVE_TABLE(CURRENT_SCHEMA,'MIGTEST_E_BASIC','TSTABLES','INDEXTS','TSTABLES','','','','','','MOVE');
|
||||
alter table migtest_e_history2 drop versioning;
|
||||
alter table migtest_e_history3 drop versioning;
|
||||
alter table migtest_e_history4 drop versioning;
|
||||
|
||||
@@ -48,6 +48,63 @@ drop table migtest_e_history_history;
|
||||
alter table migtest_e_history2 add versioning use history table migtest_e_history2_history;
|
||||
alter table migtest_e_history5 add versioning use history table migtest_e_history5_history;
|
||||
alter table "table" add versioning use history table table_history;
|
||||
drop table drop_main;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'DROP_MAIN_SEQ') then
|
||||
prepare stmt from 'drop sequence drop_main_seq';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
drop table drop_main_drop_ref_many;
|
||||
drop table drop_ref_many;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'DROP_REF_MANY_SEQ') then
|
||||
prepare stmt from 'drop sequence drop_ref_many_seq';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
drop table drop_ref_one;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'DROP_REF_ONE_SEQ') then
|
||||
prepare stmt from 'drop sequence drop_ref_one_seq';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
drop table migtest_e_test_binary;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_BINARY_SEQ') then
|
||||
prepare stmt from 'drop sequence migtest_e_test_binary_seq';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
drop table migtest_e_test_json;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_JSON_SEQ') then
|
||||
prepare stmt from 'drop sequence migtest_e_test_json_seq';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
drop table migtest_e_test_lob;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_LOB_SEQ') then
|
||||
prepare stmt from 'drop sequence migtest_e_test_lob_seq';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
drop table migtest_e_test_varchar;
|
||||
delimiter $$
|
||||
begin
|
||||
if exists (select seqschema from syscat.sequences where seqschema = current_schema and ucase(seqname) = 'MIGTEST_E_TEST_VARCHAR_SEQ') then
|
||||
prepare stmt from 'drop sequence migtest_e_test_varchar_seq';
|
||||
execute stmt;
|
||||
end if;
|
||||
end$$;
|
||||
drop table migtest_e_user;
|
||||
delimiter $$
|
||||
begin
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-283216660, 1.0__initial.sql
|
||||
1120848440, 1.1.sql
|
||||
135256939, 1.2__dropsFor_1.1.sql
|
||||
-2139056187, 1.3.sql
|
||||
946163478, 1.4__dropsFor_1.3.sql
|
||||
-1467839063, 1.0__initial.sql
|
||||
1392865974, 1.1.sql
|
||||
-1187336846, 1.2__dropsFor_1.1.sql
|
||||
-1811865535, 1.3.sql
|
||||
1864105401, 1.4__dropsFor_1.3.sql
|
||||
561281075, R__order_views.sql
|
||||
|
||||
|
||||
@@ -54,28 +54,6 @@ create table migtest_fk_set_null (
|
||||
constraint pk_migtest_fk_set_null primary key (id)
|
||||
);
|
||||
|
||||
create table drop_main (
|
||||
id integer auto_increment not null,
|
||||
constraint pk_drop_main primary key (id)
|
||||
);
|
||||
|
||||
create table drop_main_drop_ref_many (
|
||||
drop_main_id integer not null,
|
||||
drop_ref_many_id integer not null,
|
||||
constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id)
|
||||
);
|
||||
|
||||
create table drop_ref_many (
|
||||
id integer auto_increment not null,
|
||||
constraint pk_drop_ref_many primary key (id)
|
||||
);
|
||||
|
||||
create table drop_ref_one (
|
||||
id integer auto_increment not null,
|
||||
parent_id integer,
|
||||
constraint pk_drop_ref_one primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_basic (
|
||||
id integer auto_increment not null,
|
||||
status varchar(1),
|
||||
@@ -216,15 +194,6 @@ alter table migtest_fk_cascade add constraint fk_migtest_fk_cascade_one_id forei
|
||||
create index ix_migtest_fk_set_null_one_id on migtest_fk_set_null (one_id);
|
||||
alter table migtest_fk_set_null add constraint fk_migtest_fk_set_null_one_id foreign key (one_id) references migtest_fk_one (id) on delete set null on update restrict;
|
||||
|
||||
create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id);
|
||||
alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_migtest_e_basic_eref_id on migtest_e_basic (eref_id);
|
||||
alter table migtest_e_basic add constraint fk_migtest_e_basic_eref_id foreign key (eref_id) references migtest_e_ref (id) on delete restrict on update restrict;
|
||||
|
||||
|
||||
@@ -7,13 +7,128 @@ alter table migtest_e_basic drop constraint if exists ck_migtest_e_basic_status2
|
||||
alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest2;
|
||||
alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest6;
|
||||
alter table migtest_e_enum drop constraint if exists ck_migtest_e_enum_test_status;
|
||||
alter table drop_main_drop_ref_many drop constraint if exists fk_drop_main_drop_ref_many_drop_main;
|
||||
alter table drop_main_drop_ref_many drop constraint if exists fk_drop_main_drop_ref_many_drop_ref_many;
|
||||
alter table drop_ref_one drop constraint if exists fk_drop_ref_one_parent_id;
|
||||
drop index if exists ix_migtest_e_basic_indextest1;
|
||||
drop index if exists ix_migtest_e_basic_indextest5;
|
||||
drop index if exists ix_migtest_quoted_status1;
|
||||
-- apply changes
|
||||
create table drop_main (
|
||||
id integer auto_increment not null,
|
||||
constraint pk_drop_main primary key (id)
|
||||
);
|
||||
|
||||
create table drop_main_drop_ref_many (
|
||||
drop_main_id integer not null,
|
||||
drop_ref_many_id integer not null,
|
||||
constraint pk_drop_main_drop_ref_many primary key (drop_main_id,drop_ref_many_id)
|
||||
);
|
||||
|
||||
create table drop_ref_many (
|
||||
id integer auto_increment not null,
|
||||
constraint pk_drop_ref_many primary key (id)
|
||||
);
|
||||
|
||||
create table drop_ref_one (
|
||||
id integer auto_increment not null,
|
||||
parent_id integer,
|
||||
constraint pk_drop_ref_one primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_binary (
|
||||
id integer auto_increment not null,
|
||||
test_byte16 varbinary(16),
|
||||
test_byte256 varbinary(256),
|
||||
test_byte512 varbinary(512),
|
||||
test_byte1k varbinary(1024),
|
||||
test_byte2k varbinary(2048),
|
||||
test_byte4k varbinary(4096),
|
||||
test_byte8k varbinary(8192),
|
||||
test_byte16k varbinary(16384),
|
||||
test_byte32k varbinary(32768),
|
||||
test_byte64k varbinary(65536),
|
||||
test_byte128k varbinary(131072),
|
||||
test_byte256k varbinary(262144),
|
||||
test_byte512k varbinary(524288),
|
||||
test_byte1m varbinary(1048576),
|
||||
test_byte2m varbinary(2097152),
|
||||
test_byte4m varbinary(4194304),
|
||||
test_byte8m varbinary(8388608),
|
||||
test_byte16m varbinary(16777216),
|
||||
test_byte32m varbinary(33554432),
|
||||
constraint pk_migtest_e_test_binary primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_json (
|
||||
id integer auto_increment not null,
|
||||
json255 varchar(255),
|
||||
json256 varchar(256),
|
||||
json512 varchar(512),
|
||||
json1k varchar(1024),
|
||||
json2k varchar(2048),
|
||||
json4k varchar(4096),
|
||||
json8k varchar(8192),
|
||||
json16k varchar(16384),
|
||||
json32k varchar(32768),
|
||||
json64k varchar(65536),
|
||||
json128k varchar(131072),
|
||||
json256k varchar(262144),
|
||||
json512k varchar(524288),
|
||||
json1m varchar(1048576),
|
||||
json2m varchar(2097152),
|
||||
json4m varchar(4194304),
|
||||
json8m varchar(8388608),
|
||||
json16m varchar(16777216),
|
||||
json32m varchar(33554432),
|
||||
constraint pk_migtest_e_test_json primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_lob (
|
||||
id integer auto_increment not null,
|
||||
lob255 clob,
|
||||
lob256 clob,
|
||||
lob512 clob,
|
||||
lob1k clob,
|
||||
lob2k clob,
|
||||
lob4k clob,
|
||||
lob8k clob,
|
||||
lob16k clob,
|
||||
lob32k clob,
|
||||
lob64k clob,
|
||||
lob128k clob,
|
||||
lob256k clob,
|
||||
lob512k clob,
|
||||
lob1m clob,
|
||||
lob2m clob,
|
||||
lob4m clob,
|
||||
lob8m clob,
|
||||
lob16m clob,
|
||||
lob32m clob,
|
||||
constraint pk_migtest_e_test_lob primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_test_varchar (
|
||||
id integer auto_increment not null,
|
||||
varchar255 varchar(255),
|
||||
varchar256 varchar(256),
|
||||
varchar512 varchar(512),
|
||||
varchar1k varchar(1024),
|
||||
varchar2k varchar(2048),
|
||||
varchar4k varchar(4096),
|
||||
varchar8k varchar(8192),
|
||||
varchar16k varchar(16384),
|
||||
varchar32k varchar(32768),
|
||||
varchar64k varchar(65536),
|
||||
varchar128k varchar(131072),
|
||||
varchar256k varchar(262144),
|
||||
varchar512k varchar(524288),
|
||||
varchar1m varchar(1048576),
|
||||
varchar2m varchar(2097152),
|
||||
varchar4m varchar(4194304),
|
||||
varchar8m varchar(8388608),
|
||||
varchar16m varchar(16777216),
|
||||
varchar32m varchar(33554432),
|
||||
constraint pk_migtest_e_test_varchar primary key (id)
|
||||
);
|
||||
|
||||
create table migtest_e_user (
|
||||
id integer auto_increment not null,
|
||||
constraint pk_migtest_e_user primary key (id)
|
||||
@@ -96,6 +211,15 @@ comment on table migtest_e_history is 'We have history now';
|
||||
comment on column "table"."index" is 'this is an other comment';
|
||||
alter table "table" add constraint uq_table_select unique ("select");
|
||||
-- foreign keys and indices
|
||||
create index ix_drop_main_drop_ref_many_drop_main on drop_main_drop_ref_many (drop_main_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_main foreign key (drop_main_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_main_drop_ref_many_drop_ref_many on drop_main_drop_ref_many (drop_ref_many_id);
|
||||
alter table drop_main_drop_ref_many add constraint fk_drop_main_drop_ref_many_drop_ref_many foreign key (drop_ref_many_id) references drop_ref_many (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_drop_ref_one_parent_id on drop_ref_one (parent_id);
|
||||
alter table drop_ref_one add constraint fk_drop_ref_one_parent_id foreign key (parent_id) references drop_main (id) on delete restrict on update restrict;
|
||||
|
||||
create index ix_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c on migtest_mtm_c_migtest_mtm_m (migtest_mtm_c_id);
|
||||
alter table migtest_mtm_c_migtest_mtm_m add constraint fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c foreign key (migtest_mtm_c_id) references migtest_mtm_c (id) on delete restrict on update restrict;
|
||||
|
||||
|
||||
-4
@@ -7,9 +7,5 @@ alter table migtest_e_basic drop column eref_id;
|
||||
alter table migtest_e_history2 drop column obsolete_string1;
|
||||
alter table migtest_e_history2 drop column obsolete_string2;
|
||||
-- apply post alter
|
||||
drop table if exists drop_main;
|
||||
drop table if exists drop_main_drop_ref_many;
|
||||
drop table if exists drop_ref_many;
|
||||
drop table if exists drop_ref_one;
|
||||
drop table if exists "migtest_QuOtEd";
|
||||
drop table if exists migtest_e_ref;
|
||||
|
||||
@@ -14,6 +14,9 @@ alter table migtest_e_basic drop constraint uq_migtest_e_basic_name;
|
||||
alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest4;
|
||||
alter table migtest_e_basic drop constraint uq_migtest_e_basic_indextest5;
|
||||
alter table migtest_e_enum drop constraint if exists ck_migtest_e_enum_test_status;
|
||||
alter table drop_main_drop_ref_many drop constraint if exists fk_drop_main_drop_ref_many_drop_main;
|
||||
alter table drop_main_drop_ref_many drop constraint if exists fk_drop_main_drop_ref_many_drop_ref_many;
|
||||
alter table drop_ref_one drop constraint if exists fk_drop_ref_one_parent_id;
|
||||
alter table migtest_mtm_c_migtest_mtm_m drop constraint if exists fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_c;
|
||||
alter table migtest_mtm_c_migtest_mtm_m drop constraint if exists fk_migtest_mtm_c_migtest_mtm_m_migtest_mtm_m;
|
||||
alter table migtest_mtm_m_migtest_mtm_c drop constraint if exists fk_migtest_mtm_m_migtest_mtm_c_migtest_mtm_m;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user