EventsDB: enable fts conditionally based on DATABASE_URL
This commit is contained in:
parent
00d4bf2344
commit
baa6986880
|
@ -42,8 +42,17 @@ class EventsDB implements NStore {
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(private kysely: Kysely<DittoTables>) {
|
constructor(private kysely: Kysely<DittoTables>) {
|
||||||
|
let fts: 'sqlite' | 'postgres' | undefined;
|
||||||
|
|
||||||
|
if (Conf.databaseUrl.protocol === 'sqlite:') {
|
||||||
|
fts = 'sqlite';
|
||||||
|
}
|
||||||
|
if (['postgres:', 'postgresql:'].includes(Conf.databaseUrl.protocol!)) {
|
||||||
|
fts = 'postgres';
|
||||||
|
}
|
||||||
|
|
||||||
this.store = new NDatabase(kysely, {
|
this.store = new NDatabase(kysely, {
|
||||||
fts5: Conf.databaseUrl.protocol === 'sqlite:',
|
fts,
|
||||||
indexTags: EventsDB.indexTags,
|
indexTags: EventsDB.indexTags,
|
||||||
searchText: EventsDB.searchText,
|
searchText: EventsDB.searchText,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue