This commit is contained in:
m
2026-09-10 06:39:25 +02:00
parent 7dd29239b7
commit 85b1871c18
18 changed files with 783 additions and 147 deletions
+5 -1
View File
@@ -1,13 +1,17 @@
import * as SQLite from 'expo-sqlite';
import type { SQLiteDatabase } from 'expo-sqlite';
import { migrateDatabase } from './migrations';
import { DATABASE_NAME } from './schema';
let database: SQLiteDatabase | null = null;
async function loadSqlite(): Promise<typeof import('expo-sqlite')> {
return import('expo-sqlite');
}
export async function getDatabase(): Promise<SQLiteDatabase> {
if (database) return database;
const SQLite = await loadSqlite();
const db = await SQLite.openDatabaseAsync(DATABASE_NAME);
await migrateDatabase(db);
database = db;