diff --git a/.github/workflows/deno.yml b/.github/workflows/deno.yml index 93b38ee4..fe3e9362 100644 --- a/.github/workflows/deno.yml +++ b/.github/workflows/deno.yml @@ -29,7 +29,7 @@ jobs: # uses: denoland/setup-deno@v1 uses: denoland/setup-deno@d4873ceeec10de6275fecd1f94b6985369d40231 with: - deno-version: v1.x + deno-version: v1.26.1 # Uncomment this step to verify the use of 'deno fmt' on each commit. # - name: Verify formatting diff --git a/plugos/syscalls/store.deno.ts b/plugos/syscalls/store.deno.ts index 596b71a9..7d365256 100644 --- a/plugos/syscalls/store.deno.ts +++ b/plugos/syscalls/store.deno.ts @@ -13,12 +13,14 @@ export type KV = { }; export function ensureTable(db: SQLite, tableName: string) { - const stmt = db.prepare( + const result = db.query( `SELECT name FROM sqlite_master WHERE type='table' AND name=?`, + [tableName], ); - const result = stmt.all(tableName); if (result.length === 0) { - db.exec(`CREATE TABLE ${tableName} (key STRING PRIMARY KEY, value TEXT);`); + db.execute( + `CREATE TABLE ${tableName} (key STRING PRIMARY KEY, value TEXT);`, + ); console.log(`Created table ${tableName}`); } return Promise.resolve(); @@ -76,7 +78,7 @@ export function asyncQuery>( ...params: any[] ): Promise { // console.log("Querying", query, params); - return Promise.resolve(db.prepare(query).all(params)); + return Promise.resolve(db.queryEntries(query, params)); } export function asyncExecute( @@ -85,7 +87,8 @@ export function asyncExecute( ...params: any[] ): Promise { // console.log("Exdecting", query, params); - return Promise.resolve(db.exec(query, params)); + db.query(query, params); + return Promise.resolve(db.changes); } export function storeSyscalls( diff --git a/server/deps.ts b/server/deps.ts index bc1f7171..ef6143a0 100644 --- a/server/deps.ts +++ b/server/deps.ts @@ -1,3 +1,3 @@ export * from "../common/deps.ts"; -export { Database as SQLite } from "https://deno.land/x/sqlite3@0.6.1/mod.ts"; +export { DB as SQLite } from "https://deno.land/x/sqlite@v3.5.0/mod.ts"; export { Application, Router } from "https://deno.land/x/oak@v11.1.0/mod.ts"; diff --git a/server/syscalls/index.ts b/server/syscalls/index.ts index 5367ff80..92fe988f 100644 --- a/server/syscalls/index.ts +++ b/server/syscalls/index.ts @@ -22,15 +22,15 @@ export type KV = { const tableName = "page_index"; export function ensureTable(db: SQLite): Promise { - const stmt = db.prepare( + const result = db.query( `SELECT name FROM sqlite_master WHERE type='table' AND name=?`, + [tableName], ); - const result = stmt.all(tableName); if (result.length === 0) { - db.exec( + db.execute( `CREATE TABLE ${tableName} (key STRING, page STRING, value TEXT, PRIMARY KEY (page, key));`, ); - db.exec( + db.execute( `CREATE INDEX ${tableName}_idx ON ${tableName}(key);`, ); console.log(`Created table ${tableName}`); diff --git a/website/CHANGELOG.md b/website/CHANGELOG.md index 338b0029..8a38a596 100644 --- a/website/CHANGELOG.md +++ b/website/CHANGELOG.md @@ -6,6 +6,7 @@ release. ## 0.1.3 * Frontmatter support! You can now use front matter in your markdown, to do this start your page with `---` and end it with `---`. This will now be the preferred way to define page meta data (although the old way will still work). The old `/meta` slash command has now been replaced with `/front-matter`. * Tags are now indexed as page meta without the prefixing `#` character, the reason is to make this compatible with Obsidian. You can now attach tags to your page either by just using a `#tag` at the top level of your page, or by adding a `tags` attribute to your front matter. +* Silver Bullet now runs on Windows! ---