Commit f4401f8b authored by Mygod's avatar Mygod

Optimize DBHelper

parent a57d631e
...@@ -65,7 +65,8 @@ class DBHelper(val context: Context) ...@@ -65,7 +65,8 @@ class DBHelper(val context: Context)
if (oldVersion < 7) { if (oldVersion < 7) {
profileDao.executeRawNoArgs("DROP TABLE IF EXISTS 'profile';") profileDao.executeRawNoArgs("DROP TABLE IF EXISTS 'profile';")
onCreate(database, connectionSource) onCreate(database, connectionSource)
} else { return
}
if (oldVersion < 8) { if (oldVersion < 8) {
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN udpdns SMALLINT;") profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN udpdns SMALLINT;")
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN route VARCHAR;") profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN route VARCHAR;")
...@@ -88,6 +89,7 @@ class DBHelper(val context: Context) ...@@ -88,6 +89,7 @@ class DBHelper(val context: Context)
"SELECT id, name, host, localPort, remotePort, password, method, route, 1 - global, bypass, udpdns, auth," + "SELECT id, name, host, localPort, remotePort, password, method, route, 1 - global, bypass, udpdns, auth," +
" ipv6, individual FROM `tmp`;") " ipv6, individual FROM `tmp`;")
profileDao.executeRawNoArgs("DROP TABLE `tmp`;") profileDao.executeRawNoArgs("DROP TABLE `tmp`;")
return
} }
if (oldVersion < 13) { if (oldVersion < 13) {
profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN tx LONG;") profileDao.executeRawNoArgs("ALTER TABLE `profile` ADD COLUMN tx LONG;")
...@@ -96,5 +98,4 @@ class DBHelper(val context: Context) ...@@ -96,5 +98,4 @@ class DBHelper(val context: Context)
} }
} }
} }
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment