Skip to content

Commit

Permalink
Fixed migration I guess?
Browse files Browse the repository at this point in the history
  • Loading branch information
LucFauvel committed Aug 18, 2024
1 parent ed86b65 commit 613404d
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions apps/desktop/src/utils/migration.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { BaseDirectory, createDir, exists, readTextFile, writeFile } from "@tauri-apps/plugin-fs";
import { BaseDirectory, readTextFile, writeTextFile } from "@tauri-apps/plugin-fs";

export async function completeMigration(name: string) {
try {
if (!(await exists("migrations", { dir: BaseDirectory.AppConfig }))) {
await createDir("migrations", { dir: BaseDirectory.AppConfig });
}

await writeFile(`migrations/${name}.json`, JSON.stringify({ completed: true }), { dir: BaseDirectory.AppConfig });
await writeTextFile(`migrations/${name}.json`, JSON.stringify({ completed: true }), {
baseDir: BaseDirectory.AppConfig,
});
} catch (e) {
console.error(e);
}
Expand All @@ -15,7 +13,7 @@ export async function completeMigration(name: string) {
export async function isMigrationComplete(name: string): Promise<boolean> {
try {
const contents = await readTextFile(`migrations/${name}.json`, {
dir: BaseDirectory.AppConfig,
baseDir: BaseDirectory.AppConfig,
});

return JSON.parse(contents).completed;
Expand Down

0 comments on commit 613404d

Please sign in to comment.