mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Switch to NPostgres (steamroll SQLite for now)
This commit is contained in:
parent
66cfba5535
commit
916b68a3e4
3 changed files with 9 additions and 11 deletions
|
|
@ -30,7 +30,7 @@
|
|||
"@isaacs/ttlcache": "npm:@isaacs/ttlcache@^1.4.1",
|
||||
"@lambdalisue/async": "jsr:@lambdalisue/async@^2.1.1",
|
||||
"@noble/secp256k1": "npm:@noble/secp256k1@^2.0.0",
|
||||
"@nostrify/db": "jsr:@nostrify/db@^0.30.0",
|
||||
"@nostrify/db": "jsr:@nostrify/db@^0.31.0",
|
||||
"@nostrify/nostrify": "jsr:@nostrify/nostrify@^0.30.0",
|
||||
"@scure/base": "npm:@scure/base@^1.1.6",
|
||||
"@sentry/deno": "https://deno.land/x/sentry@7.112.2/index.mjs",
|
||||
|
|
|
|||
8
deno.lock
generated
8
deno.lock
generated
|
|
@ -11,7 +11,7 @@
|
|||
"jsr:@gleasonator/policy@0.4.1": "jsr:@gleasonator/policy@0.4.1",
|
||||
"jsr:@hono/hono@^4.4.6": "jsr:@hono/hono@4.5.3",
|
||||
"jsr:@lambdalisue/async@^2.1.1": "jsr:@lambdalisue/async@2.1.1",
|
||||
"jsr:@nostrify/db@^0.30.0": "jsr:@nostrify/db@0.30.0",
|
||||
"jsr:@nostrify/db@^0.31.0": "jsr:@nostrify/db@0.31.0",
|
||||
"jsr:@nostrify/nostrify@^0.22.1": "jsr:@nostrify/nostrify@0.22.5",
|
||||
"jsr:@nostrify/nostrify@^0.22.4": "jsr:@nostrify/nostrify@0.22.4",
|
||||
"jsr:@nostrify/nostrify@^0.22.5": "jsr:@nostrify/nostrify@0.22.5",
|
||||
|
|
@ -138,8 +138,8 @@
|
|||
"@lambdalisue/async@2.1.1": {
|
||||
"integrity": "1fc9bc6f4ed50215cd2f7217842b18cea80f81c25744f88f8c5eb4be5a1c9ab4"
|
||||
},
|
||||
"@nostrify/db@0.30.0": {
|
||||
"integrity": "a75ba78be89d57c54c3d47e9e94c7142817c5b50daec27bf7f9a4af4629be20b",
|
||||
"@nostrify/db@0.31.0": {
|
||||
"integrity": "e1621f553aae431ad1d592de40684767b48ebc0b77cd36498eb92101c40374f0",
|
||||
"dependencies": [
|
||||
"jsr:@nostrify/nostrify@^0.30.0",
|
||||
"jsr:@nostrify/types@^0.30.0",
|
||||
|
|
@ -1827,7 +1827,7 @@
|
|||
"jsr:@db/sqlite@^0.11.1",
|
||||
"jsr:@hono/hono@^4.4.6",
|
||||
"jsr:@lambdalisue/async@^2.1.1",
|
||||
"jsr:@nostrify/db@^0.30.0",
|
||||
"jsr:@nostrify/db@^0.31.0",
|
||||
"jsr:@nostrify/nostrify@^0.30.0",
|
||||
"jsr:@soapbox/kysely-deno-sqlite@^2.1.0",
|
||||
"jsr:@soapbox/stickynotes@^0.4.0",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// deno-lint-ignore-file require-await
|
||||
|
||||
import { NDatabase } from '@nostrify/db';
|
||||
import { NPostgres } from '@nostrify/db';
|
||||
import {
|
||||
NIP50,
|
||||
NKinds,
|
||||
|
|
@ -33,7 +33,7 @@ type TagCondition = ({ event, count, value }: {
|
|||
|
||||
/** SQLite database storage adapter for Nostr events. */
|
||||
class EventsDB implements NStore {
|
||||
private store: NDatabase;
|
||||
private store: NPostgres;
|
||||
private console = new Stickynotes('ditto:db:events');
|
||||
|
||||
/** Conditions for when to index certain tags. */
|
||||
|
|
@ -54,11 +54,9 @@ class EventsDB implements NStore {
|
|||
};
|
||||
|
||||
constructor(private kysely: Kysely<DittoTables>) {
|
||||
this.store = new NDatabase(kysely, {
|
||||
fts: Conf.db.dialect,
|
||||
timeoutStrategy: Conf.db.dialect === 'postgres' ? 'setStatementTimeout' : undefined,
|
||||
this.store = new NPostgres(kysely, {
|
||||
indexTags: EventsDB.indexTags,
|
||||
searchText: EventsDB.searchText,
|
||||
indexSearch: EventsDB.searchText,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue