[core] Fix create index (#993)

This commit is contained in:
LoveSy 2021-08-24 12:29:29 +08:00 committed by GitHub
parent 04352a7da6
commit 7c16f7d6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 5 deletions

View File

@ -148,7 +148,6 @@ public class ConfigManager {
"data blob NOT NULL," + "data blob NOT NULL," +
"PRIMARY KEY (module_pkg_name, user_id, `group`, `key`)" + "PRIMARY KEY (module_pkg_name, user_id, `group`, `key`)" +
");"); ");");
private final SQLiteStatement createConfigIndex = db.compileStatement("CREATE INDEX IF NOT EXISTS configs_idx ON configs (module_pkg_name, user_id);");
private final Map<ProcessScope, List<Module>> cachedScope = new ConcurrentHashMap<>(); private final Map<ProcessScope, List<Module>> cachedScope = new ConcurrentHashMap<>();
@ -285,10 +284,14 @@ public class ConfigManager {
} }
private void createTables() { private void createTables() {
createModulesTable.execute(); try {
createScopeTable.execute(); createModulesTable.execute();
createConfigTable.execute(); createScopeTable.execute();
createConfigIndex.execute(); createConfigTable.execute();
db.compileStatement("CREATE INDEX IF NOT EXISTS configs_idx ON configs (module_pkg_name, user_id);").execute();
} catch (Throwable e) {
Log.e(TAG, "init db", e);
}
} }
private List<ProcessScope> getAssociatedProcesses(Application app) throws RemoteException { private List<ProcessScope> getAssociatedProcesses(Application app) throws RemoteException {