mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-29 15:36:11 +00:00
Fix migrations
This commit is contained in:
parent
6ba57d701f
commit
5bb2e8203c
|
@ -15,6 +15,7 @@ import "@/setup/index.css";
|
|||
import { useLanguageStore } from "@/stores/language";
|
||||
|
||||
import { initializeChromecast } from "./setup/chromecast";
|
||||
import "./stores/__old/imports";
|
||||
import { initializeOldStores } from "./stores/__old/migrations";
|
||||
|
||||
// initialize
|
||||
|
|
4
src/stores/__old/imports.ts
Normal file
4
src/stores/__old/imports.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
import "./bookmark/store";
|
||||
import "./settings/store";
|
||||
import "./volume/store";
|
||||
import "./watched/store";
|
|
@ -27,6 +27,7 @@ const storeCallbacks: Record<string, ((data: any) => void)[]> = {};
|
|||
const stores: Record<string, [StoreRet<any>, InternalStoreData]> = {};
|
||||
|
||||
export async function initializeOldStores() {
|
||||
console.log(stores);
|
||||
// migrate all stores
|
||||
for (const [store, internal] of Object.values(stores)) {
|
||||
const versions = internal.versions.sort((a, b) => a.version - b.version);
|
||||
|
@ -168,6 +169,7 @@ export function createVersionedStore<T>(): StoreBuilder<T> {
|
|||
return this;
|
||||
},
|
||||
build() {
|
||||
console.log(_data.key);
|
||||
assertStore(_data);
|
||||
const storageObject = buildStorageObject<T>(_data);
|
||||
stores[_data.key ?? ""] = [storageObject, _data];
|
||||
|
|
Loading…
Reference in a new issue