mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2024-12-04 16:11:46 +01:00
Cleanup/duplicate datastore module (#2023)
* - Remove duplicate datastore file Which is not referenced and comes from old PR * - Remove unncessary index
This commit is contained in:
parent
8bacacc870
commit
16166ba843
@ -20,5 +20,5 @@ db.history = Datastore.create({ filename: dbPath('history'), autoload: true })
|
||||
|
||||
db.history.ensureIndex({ fieldName: 'author' })
|
||||
db.history.ensureIndex({ fieldName: 'title' })
|
||||
db.history.ensureIndex({ fieldName: 'videoId' })
|
||||
|
||||
export default db
|
||||
|
@ -1,51 +0,0 @@
|
||||
import Datastore from 'nedb-promises'
|
||||
|
||||
// Initialize all datastores and export their references
|
||||
// Current dbs:
|
||||
// `settings.db`
|
||||
// `profiles.db`
|
||||
// `playlists.db`
|
||||
// `history.db`
|
||||
|
||||
let buildFileName = null
|
||||
|
||||
// Check if using Electron
|
||||
const usingElectron = window?.process?.type === 'renderer'
|
||||
if (usingElectron) {
|
||||
const { ipcRenderer } = require('electron')
|
||||
const userDataPath = ipcRenderer.sendSync('getUserDataPathSync')
|
||||
buildFileName = (dbName) => userDataPath + '/' + dbName + '.db'
|
||||
} else {
|
||||
buildFileName = (dbName) => dbName + '.db'
|
||||
}
|
||||
|
||||
const settingsDb = Datastore.create({
|
||||
filename: buildFileName('settings'),
|
||||
autoload: true
|
||||
})
|
||||
|
||||
const playlistsDb = Datastore.create({
|
||||
filename: buildFileName('playlists'),
|
||||
autoload: true
|
||||
})
|
||||
|
||||
const profilesDb = Datastore.create({
|
||||
filename: buildFileName('profiles'),
|
||||
autoload: true
|
||||
})
|
||||
|
||||
const historyDb = Datastore.create({
|
||||
filename: buildFileName('history'),
|
||||
autoload: true
|
||||
})
|
||||
|
||||
historyDb.ensureIndex({ fieldName: 'author' })
|
||||
historyDb.ensureIndex({ fieldName: 'title' })
|
||||
historyDb.ensureIndex({ fieldName: 'videoId' })
|
||||
|
||||
export {
|
||||
settingsDb,
|
||||
profilesDb,
|
||||
playlistsDb,
|
||||
historyDb
|
||||
}
|
Loading…
Reference in New Issue
Block a user