SQLiteUtils { @NonNull public static List<String> createIndexDefinition(TableInfo tableInfo) { ArrayList<String> definitions = new ArrayList<>(); SparseArray<IndexGroupInfo> indexGroups = tableInfo.getIndexGroups(); for (int i = 0; i < indexGroups.size(); i++) { int key = indexGroups.keyAt(i); IndexGroupInfo indexGroupInfo = indexGroups.get(key); String name = indexGroupInfo.name != null ? indexGroupInfo.name : tableInfo.getTableName(); if (indexGroupInfo.columns.size() > 0) { definitions.add(String.format("CREATE INDEX IF NOT EXISTS %s on %s(%s);", "index_" + tableInfo.getTableName() + "_" + name, tableInfo.getTableName(), join(indexGroupInfo.columns))); } } return definitions; }  @NonNull static String getIdentityHash(Collection<TableInfo> tableInfos); @NonNull static ArrayList<String> getAllTableNames(SQLiteDatabase database); @NonNull static String createTableDefinition(TableInfo tableInfo); @NonNull static List<String> createIndexDefinition(TableInfo tableInfo); static SQLiteType getFieldSQLiteType(Field field, Map<Class<?>, TypeSerializer> typeSerializers); static Object getColumnFieldValue(Class<?> modelClass,
                                             Class<?> fieldType,
                                             Cursor cursor,
                                             int columnIndex); static void fillContentValuesForUpdate(Object model,
                                                  ModelAdapter modelAdapter,
                                                  ContentValues contentValues); static void fillContentValuesForInsert(Object model,
                                                  ModelAdapter modelAdapter,
                                                  ContentValues contentValues);  }
@Test public void testCreateIndexDefinition() throws NoSuchFieldException { String expectedSql = "CREATE INDEX IF NOT EXISTS index_FullTestModel_index_1 on FullTestModel(`doubleField`, `intField`);"; TableInfo testModelTableInfo = ReActiveAndroid.getTableInfo(FullTestModel.class); List<String> createIndexDefinition = SQLiteUtils.createIndexDefinition(testModelTableInfo); assertEquals(expectedSql, TextUtils.join(", ", createIndexDefinition)); }