ruchiD commented on code in PR #2798:
URL: https://github.com/apache/fineract/pull/2798#discussion_r1045507415


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java:
##########
@@ -871,6 +884,24 @@ public CommandProcessingResult createDatatable(final 
JsonCommand command) {
         return new 
CommandProcessingResultBuilder().withCommandId(command.commandId()).withResourceIdAsString(datatableName).build();
     }
 
+    private void createIndexesForTable(String datatableName, JsonArray 
columns) {
+        for (final JsonElement column : columns) {
+            createIndexForColumn(datatableName, column.getAsJsonObject());
+        }
+    }
+
+    private void createIndexForColumn(String datatableName, JsonObject column) 
{
+        String name = column.has("name") ? column.get("name").getAsString() : 
null;
+        final Boolean unique = column.has("unique") ? 
column.get("unique").getAsBoolean() : false;
+        final Boolean indexed = column.has("indexed") ? 
column.get("indexed").getAsBoolean() : false;
+        if (indexed) {
+            if (!unique) {

Review Comment:
   When unique constraint is added on a column, an index is created by database 
with the same name as unique constraint name. so no need to create index 
separately.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@fineract.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to