Skip to content

Issue #17 - Create table when not exist #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2019
Merged

Issue #17 - Create table when not exist #219

merged 1 commit into from
Jan 23, 2019

Conversation

derjust
Copy link
Owner

@derjust derjust commented Nov 6, 2018

No description provided.

@derjust derjust force-pushed the Issue-17 branch 2 times, most recently from e9a2b60 to 51cc075 Compare November 6, 2018 14:03
@codecov-io
Copy link

codecov-io commented Nov 6, 2018

Codecov Report

Merging #219 into master will increase coverage by 1.9%.
The diff coverage is 79.39%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master     #219     +/-   ##
===========================================
+ Coverage      65.4%   67.31%   +1.9%     
- Complexity      600      656     +56     
===========================================
  Files            77       83      +6     
  Lines          2038     2227    +189     
  Branches        374      392     +18     
===========================================
+ Hits           1333     1499    +166     
+ Misses          550      549      -1     
- Partials        155      179     +24
Impacted Files Coverage Δ Complexity Δ
...epository/query/AbstractDynamoDBQueryCriteria.java 68.08% <0%> (+0.4%) 100 <0> (+1) ⬆️
...pository/util/DynamoDBMappingContextProcessor.java 100% <100%> (ø) 2 <2> (?)
.../repository/support/DynamoDBRepositoryFactory.java 85.1% <100%> (ø) 20 <1> (ø) ⬇️
...ring/data/dynamodb/repository/util/Entity2DDL.java 100% <100%> (ø) 6 <6> (?)
...in/spring/data/dynamodb/core/DynamoDBTemplate.java 70% <100%> (-0.59%) 16 <1> (-5)
...amodb/repository/config/DynamoDBMapperFactory.java 100% <100%> (ø) 3 <3> (?)
...pository/support/SimpleDynamoDBCrudRepository.java 81.03% <50%> (+0.33%) 16 <1> (+1) ⬆️
...tory/util/EntityInformationProxyPostProcessor.java 63.63% <63.63%> (ø) 2 <2> (?)
...ository/support/DynamoDBRepositoryFactoryBean.java 77.77% <66.66%> (-22.23%) 7 <3> (-1)
...ository/util/Entity2DynamoDBTableSynchronizer.java 70.88% <70.88%> (ø) 18 <18> (?)
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 03c017d...ff913ad. Read the comment docs.

@derjust derjust force-pushed the Issue-17 branch 8 times, most recently from 6e7f61c to 8513654 Compare November 15, 2018 03:26
@derjust derjust force-pushed the Issue-17 branch 2 times, most recently from dcf0160 to 9566c39 Compare November 28, 2018 05:15
@derjust derjust changed the title Issue 17 Issue #17 - Create table when not exist Nov 28, 2018
@derjust derjust force-pushed the Issue-17 branch 4 times, most recently from 714b1d9 to 9d6fa71 Compare January 23, 2019 03:08
A new property is introduced to automatically handle table creation (Key columns + GSIs):
`spring.data.dynamodb.entity2ddl.auto`

That can be any of the following settings
* `none` - The default. No action performed
* `create-only` - Tables are created on Spring startup if table doesn't exist
* `drop` - Tables are dropped on Spring context shutdown
* `create` - Tables are dropped & created on Spring startup
* `create-drop` - Tables are dropped & created on Spring startup and dropped on shutdown
* `validate` - The existing tables are checked to exist - otherwise an Exception is generated on Spring context startup

There are additional settings for the creation of tables:

`spring.data.dynamodb.entity2ddl.gsiProjectionType`: The projection type for the GSIs
* `ALL`
* `KEYS_ONLY`
* `INCLUDE`

Please consult `com.amazonaws.services.dynamodbv2.model.ProjectionType`

`spring.data.dynamodb.entity2ddl.readCapacity` (default `10`): The read capacity for the GSIs & the table itself
`spring.data.dynamodb.entity2ddl.writeCapacity` (default `1`): The write capacity for the GSIs & the table itself

To achieve this, some substantial refactoring was required as a lot of objects were created outside of the Spring context.
All changes should be backward compatible and not change any semantic but if anything is broken - please report!
@derjust derjust merged commit d9737a6 into master Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants