MCPcopy
hub / github.com/opral/inlang / initDb

Function initDb

packages/sdk/src/database/initDb.ts:8–21  ·  view source on GitHub ↗
(args: { sqlite: SqliteWasmDatabase })

Source from the content-addressed store, hash-verified

6import { JsonbPlugin } from "./jsonbPlugin.js";
7
8export function initDb(args: { sqlite: SqliteWasmDatabase }) {
9 initDefaultValueFunctions({ sqlite: args.sqlite });
10 applySchema({ sqlite: args.sqlite });
11 const db = new Kysely<InlangDatabaseSchema>({
12 dialect: createDialect({
13 database: args.sqlite,
14 }),
15 plugins: [
16 new CamelCasePlugin(),
17 new JsonbPlugin({ database: args.sqlite }),
18 ],
19 });
20 return db;
21}
22
23function initDefaultValueFunctions(args: { sqlite: SqliteWasmDatabase }) {
24 args.sqlite.createFunction({

Callers 6

newProjectFunction · 0.85
loadProjectFunction · 0.85
applyChangesFunction · 0.85

Calls 2

applySchemaFunction · 0.85

Tested by

no test coverage detected