Spaces:
Sleeping
Sleeping
Download apps/server/src/database/create-database.ts from phucsd/Oloka-Video-Dev: direct link, hf CLI and curl.
- Browser
- Download file 955 Bytes
-
https://huggingface.co/spaces/phucsd/Oloka-Video-Dev/resolve/main/apps/server/src/database/create-database.ts
- Command line
-
hf download hf://spaces/phucsd/Oloka-Video-Dev/apps/server/src/database/create-database.ts
-
curl -L -o create-database.ts https://huggingface.co/spaces/phucsd/Oloka-Video-Dev/resolve/main/apps/server/src/database/create-database.ts
955 Bytes
| import type { SystemDatabase } from "./database.js"; | |
| import { SqliteSystemDatabase } from "./sqlite-system-database.js"; | |
| import type { AppEnvironment } from "../config/environment.js"; | |
| import { join } from "node:path"; | |
| import { pathToFileURL } from "node:url"; | |
| import type { OperationalMetrics } from "../observability/operational-metrics.js"; | |
| import { prepareLocalDatabasePath } from "../startup/database-path.js"; | |
| export async function createDatabase( | |
| environment: AppEnvironment, | |
| metrics?: OperationalMetrics, | |
| ): Promise<SystemDatabase> { | |
| await prepareLocalDatabasePath({ | |
| databasePath: environment.databasePath, | |
| objectStorageRoot: environment.objectStorageRoot, | |
| }); | |
| return SqliteSystemDatabase.connect( | |
| pathToFileURL(environment.databasePath).href, | |
| { | |
| appBuildSha: environment.gitCommitSha, | |
| appKey: environment.appKey, | |
| backupRoot: join(environment.objectStorageRoot, "backups"), | |
| metrics, | |
| }, | |
| ); | |
| } | |