mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-05 22:36:05 +02:00
upgrade db version
This commit is contained in:
@@ -109,12 +109,12 @@ const routes = [
|
|||||||
component: () =>
|
component: () =>
|
||||||
import('./../views/Charts/components/MutualFriends.vue')
|
import('./../views/Charts/components/MutualFriends.vue')
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
path: 'charts/hot-worlds',
|
// path: 'charts/hot-worlds',
|
||||||
name: 'charts-hot-worlds',
|
// name: 'charts-hot-worlds',
|
||||||
component: () =>
|
// component: () =>
|
||||||
import('./../views/Charts/components/HotWorlds.vue')
|
// import('./../views/Charts/components/HotWorlds.vue')
|
||||||
},
|
// },
|
||||||
{ path: 'tools', name: 'tools', component: Tools },
|
{ path: 'tools', name: 'tools', component: Tools },
|
||||||
{
|
{
|
||||||
path: 'tools/gallery',
|
path: 'tools/gallery',
|
||||||
|
|||||||
@@ -148,6 +148,9 @@ const database = {
|
|||||||
await sqliteService.executeNonQuery(
|
await sqliteService.executeNonQuery(
|
||||||
`CREATE TABLE IF NOT EXISTS ${dbVars.userPrefix}_friend_log_history (id INTEGER PRIMARY KEY, created_at TEXT, type TEXT, user_id TEXT, display_name TEXT, previous_display_name TEXT, trust_level TEXT, previous_trust_level TEXT, friend_number INTEGER)`
|
`CREATE TABLE IF NOT EXISTS ${dbVars.userPrefix}_friend_log_history (id INTEGER PRIMARY KEY, created_at TEXT, type TEXT, user_id TEXT, display_name TEXT, previous_display_name TEXT, trust_level TEXT, previous_trust_level TEXT, friend_number INTEGER)`
|
||||||
);
|
);
|
||||||
|
await sqliteService.executeNonQuery(
|
||||||
|
`CREATE INDEX IF NOT EXISTS ${dbVars.userPrefix}_friend_log_history_user_id_idx ON ${dbVars.userPrefix}_friend_log_history (user_id)`
|
||||||
|
);
|
||||||
await sqliteService.executeNonQuery(
|
await sqliteService.executeNonQuery(
|
||||||
`CREATE TABLE IF NOT EXISTS ${dbVars.userPrefix}_notifications (id TEXT PRIMARY KEY, created_at TEXT, type TEXT, sender_user_id TEXT, sender_username TEXT, receiver_user_id TEXT, message TEXT, world_id TEXT, world_name TEXT, image_url TEXT, invite_message TEXT, request_message TEXT, response_message TEXT, expired INTEGER)`
|
`CREATE TABLE IF NOT EXISTS ${dbVars.userPrefix}_notifications (id TEXT PRIMARY KEY, created_at TEXT, type TEXT, sender_user_id TEXT, sender_username TEXT, receiver_user_id TEXT, message TEXT, world_id TEXT, world_name TEXT, image_url TEXT, invite_message TEXT, request_message TEXT, response_message TEXT, expired INTEGER)`
|
||||||
);
|
);
|
||||||
@@ -178,9 +181,21 @@ const database = {
|
|||||||
await sqliteService.executeNonQuery(
|
await sqliteService.executeNonQuery(
|
||||||
`CREATE INDEX IF NOT EXISTS gamelog_location_created_at_idx ON gamelog_location (created_at)`
|
`CREATE INDEX IF NOT EXISTS gamelog_location_created_at_idx ON gamelog_location (created_at)`
|
||||||
);
|
);
|
||||||
|
await sqliteService.executeNonQuery(
|
||||||
|
`CREATE INDEX IF NOT EXISTS idx_gamelog_location_world_created ON gamelog_location (world_id, created_at)`
|
||||||
|
);
|
||||||
await sqliteService.executeNonQuery(
|
await sqliteService.executeNonQuery(
|
||||||
`CREATE TABLE IF NOT EXISTS gamelog_join_leave (id INTEGER PRIMARY KEY, created_at TEXT, type TEXT, display_name TEXT, location TEXT, user_id TEXT, time INTEGER, UNIQUE(created_at, type, display_name))`
|
`CREATE TABLE IF NOT EXISTS gamelog_join_leave (id INTEGER PRIMARY KEY, created_at TEXT, type TEXT, display_name TEXT, location TEXT, user_id TEXT, time INTEGER, UNIQUE(created_at, type, display_name))`
|
||||||
);
|
);
|
||||||
|
await sqliteService.executeNonQuery(
|
||||||
|
`CREATE INDEX IF NOT EXISTS idx_gamelog_jl_location ON gamelog_join_leave (location)`
|
||||||
|
);
|
||||||
|
await sqliteService.executeNonQuery(
|
||||||
|
`CREATE INDEX IF NOT EXISTS idx_gamelog_jl_user_created ON gamelog_join_leave (user_id, created_at)`
|
||||||
|
);
|
||||||
|
await sqliteService.executeNonQuery(
|
||||||
|
`CREATE INDEX IF NOT EXISTS idx_gamelog_jl_display_created ON gamelog_join_leave (display_name, created_at)`
|
||||||
|
);
|
||||||
await sqliteService.executeNonQuery(
|
await sqliteService.executeNonQuery(
|
||||||
`CREATE TABLE IF NOT EXISTS gamelog_portal_spawn (id INTEGER PRIMARY KEY, created_at TEXT, display_name TEXT, location TEXT, user_id TEXT, instance_id TEXT, world_name TEXT, UNIQUE(created_at, display_name))`
|
`CREATE TABLE IF NOT EXISTS gamelog_portal_spawn (id INTEGER PRIMARY KEY, created_at TEXT, display_name TEXT, location TEXT, user_id TEXT, instance_id TEXT, world_name TEXT, UNIQUE(created_at, display_name))`
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const tableAlter = {
|
|||||||
await this.updateTableForGroupNames();
|
await this.updateTableForGroupNames();
|
||||||
await this.addFriendLogFriendNumber();
|
await this.addFriendLogFriendNumber();
|
||||||
await this.updateTableForAvatarHistory();
|
await this.updateTableForAvatarHistory();
|
||||||
|
await this.addPerformanceIndexes(); // 16
|
||||||
// }
|
// }
|
||||||
// await sqliteService.executeNonQuery('PRAGMA user_version = 1');
|
// await sqliteService.executeNonQuery('PRAGMA user_version = 1');
|
||||||
},
|
},
|
||||||
@@ -82,6 +83,39 @@ const tableAlter = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async addPerformanceIndexes() {
|
||||||
|
// gamelog_location: covers getLastVisit, getVisitCount, getTimeSpentInWorld, getPreviousInstancesByWorldId, getMyTopWorlds
|
||||||
|
await sqliteService.executeNonQuery(
|
||||||
|
`CREATE INDEX IF NOT EXISTS idx_gamelog_location_world_created ON gamelog_location (world_id, created_at)`
|
||||||
|
);
|
||||||
|
// gamelog_join_leave: covers getPlayersFromInstance, getPlayerDetailFromInstance
|
||||||
|
await sqliteService.executeNonQuery(
|
||||||
|
`CREATE INDEX IF NOT EXISTS idx_gamelog_jl_location ON gamelog_join_leave (location)`
|
||||||
|
);
|
||||||
|
// gamelog_join_leave: covers getUserStats, getAllUserStats, getLastSeen, getPreviousInstancesByUserId, getPreviousDisplayNamesByUserId
|
||||||
|
await sqliteService.executeNonQuery(
|
||||||
|
`CREATE INDEX IF NOT EXISTS idx_gamelog_jl_user_created ON gamelog_join_leave (user_id, created_at)`
|
||||||
|
);
|
||||||
|
// gamelog_join_leave: covers getUserStats, getLastSeen for display_name OR path
|
||||||
|
await sqliteService.executeNonQuery(
|
||||||
|
`CREATE INDEX IF NOT EXISTS idx_gamelog_jl_display_created ON gamelog_join_leave (display_name, created_at)`
|
||||||
|
);
|
||||||
|
|
||||||
|
// per-user friend_log_history: covers getFriendLogHistoryForUserId
|
||||||
|
var tables = [];
|
||||||
|
await sqliteService.execute((dbRow) => {
|
||||||
|
tables.push(dbRow[0]);
|
||||||
|
}, `SELECT name FROM sqlite_schema WHERE type='table' AND name LIKE '%_friend_log_history'`);
|
||||||
|
for (var tableName of tables) {
|
||||||
|
try {
|
||||||
|
await sqliteService.executeNonQuery(
|
||||||
|
`CREATE INDEX IF NOT EXISTS ${tableName}_user_id_idx ON ${tableName} (user_id)`
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export { tableAlter };
|
export { tableAlter };
|
||||||
|
|||||||
+18
-15
@@ -98,17 +98,22 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
|||||||
try {
|
try {
|
||||||
if (LINUX) {
|
if (LINUX) {
|
||||||
try {
|
try {
|
||||||
window.electron.ipcRenderer.on('launch-command', (command) => {
|
window.electron.ipcRenderer.on(
|
||||||
if (command) {
|
'launch-command',
|
||||||
eventLaunchCommand(command);
|
(command) => {
|
||||||
|
if (command) {
|
||||||
|
eventLaunchCommand(command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
window.electron.onWindowPositionChanged((event, position) => {
|
window.electron.onWindowPositionChanged(
|
||||||
state.locationX = position.x;
|
(event, position) => {
|
||||||
state.locationY = position.y;
|
state.locationX = position.x;
|
||||||
debounce(saveVRCXWindowOption, 300)();
|
state.locationY = position.y;
|
||||||
});
|
debounce(saveVRCXWindowOption, 300)();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
window.electron.onWindowSizeChanged((event, size) => {
|
window.electron.onWindowSizeChanged((event, size) => {
|
||||||
state.sizeWidth = size.width;
|
state.sizeWidth = size.width;
|
||||||
@@ -156,11 +161,9 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
|||||||
await VRCXStorage.Set('VRCX_DisableGpuAcceleration', 'false');
|
await VRCXStorage.Set('VRCX_DisableGpuAcceleration', 'false');
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
(
|
(await VRCXStorage.Get(
|
||||||
await VRCXStorage.Get(
|
'VRCX_DisableVrOverlayGpuAcceleration'
|
||||||
'VRCX_DisableVrOverlayGpuAcceleration'
|
)) === ''
|
||||||
)
|
|
||||||
) === ''
|
|
||||||
) {
|
) {
|
||||||
await VRCXStorage.Set(
|
await VRCXStorage.Set(
|
||||||
'VRCX_DisableVrOverlayGpuAcceleration',
|
'VRCX_DisableVrOverlayGpuAcceleration',
|
||||||
@@ -219,7 +222,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
|||||||
*/
|
*/
|
||||||
async function updateDatabaseVersion() {
|
async function updateDatabaseVersion() {
|
||||||
// requires dbVars.userPrefix to be already set
|
// requires dbVars.userPrefix to be already set
|
||||||
const databaseVersion = 15;
|
const databaseVersion = 16;
|
||||||
if (state.databaseVersion < databaseVersion) {
|
if (state.databaseVersion < databaseVersion) {
|
||||||
databaseUpgradeState.value = {
|
databaseUpgradeState.value = {
|
||||||
visible: state.databaseVersion > 0,
|
visible: state.databaseVersion > 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user