Use one database
This will make backup/restore operations less complicated.
This commit is contained in:
parent
d455ee29f6
commit
28e4fef2d2
@ -1,6 +1,6 @@
|
|||||||
import { TypeSpec } from 'pouchorm';
|
import { TypeSpec } from 'pouchorm';
|
||||||
|
|
||||||
import { PouchDB } from '../services/db.js';
|
import { PouchDB, db } from '../services/db.js';
|
||||||
import { ImageType } from '../data/image.js';
|
import { ImageType } from '../data/image.js';
|
||||||
import { extractID } from '../utils/conversion.js';
|
import { extractID } from '../utils/conversion.js';
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ class AlbumSpec extends TypeSpec {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const AlbumType = PouchDB.registerType('Album', AlbumSpec);
|
export const AlbumType = PouchDB.registerType('Album', AlbumSpec, db);
|
||||||
|
|
||||||
ImageType.subscribe((id, deleted, doc) => {
|
ImageType.subscribe((id, deleted, doc) => {
|
||||||
if (!deleted) {
|
if (!deleted) {
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { TypeSpec } from 'pouchorm';
|
import { TypeSpec } from 'pouchorm';
|
||||||
|
|
||||||
import { PouchDB } from '../services/db.js';
|
|
||||||
import { sha1 } from '../utils/crypto.js';
|
import { sha1 } from '../utils/crypto.js';
|
||||||
import { blobToArrayBuffer } from '../utils/conversion.js';
|
import { blobToArrayBuffer } from '../utils/conversion.js';
|
||||||
|
import { PouchDB, db } from '../services/db.js';
|
||||||
|
|
||||||
class FileSpec extends TypeSpec {
|
class FileSpec extends TypeSpec {
|
||||||
static getUniqueID(doc) {
|
static getUniqueID(doc) {
|
||||||
@ -73,4 +73,4 @@ class FileSpec extends TypeSpec {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FileType = PouchDB.registerType('File', FileSpec);
|
export const FileType = PouchDB.registerType('File', FileSpec, db);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { TypeSpec } from 'pouchorm';
|
import { TypeSpec } from 'pouchorm';
|
||||||
|
|
||||||
import { PouchDB } from '../services/db.js';
|
import { PouchDB, db } from '../services/db.js';
|
||||||
import { blobToArrayBuffer, deepAssign } from '../utils/conversion.js';
|
import { blobToArrayBuffer, deepAssign } from '../utils/conversion.js';
|
||||||
import { backgroundTask } from '../utils/event.js';
|
import { backgroundTask } from '../utils/event.js';
|
||||||
import { FileType } from './file.js';
|
import { FileType } from './file.js';
|
||||||
@ -122,7 +122,7 @@ const processImportables = backgroundTask(async function _processImportables(ima
|
|||||||
module.generateThumbnailForImage(image);
|
module.generateThumbnailForImage(image);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
export const ImageType = PouchDB.registerType('Image', ImageSpec);
|
export const ImageType = PouchDB.registerType('Image', ImageSpec, db);
|
||||||
|
|
||||||
ImageType.index('originalDate', ['originalDate', 'id']);
|
ImageType.index('originalDate', ['originalDate', 'id']);
|
||||||
|
|
||||||
|
|||||||
@ -20,3 +20,7 @@ export const PouchDB = core
|
|||||||
// )
|
// )
|
||||||
// )
|
// )
|
||||||
.plugin(PouchORM);
|
.plugin(PouchORM);
|
||||||
|
|
||||||
|
export const db = new PouchDB('gallery');
|
||||||
|
|
||||||
|
self.db = db;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user