Compare commits
No commits in common. "05c59937e9cbdc62015741d1eb56656eb8d0dbd6" and "39d66e5280d5eaf80db2b85c62c233aa0dbb23b9" have entirely different histories.
05c59937e9
...
39d66e5280
@ -88,14 +88,12 @@ class SqliteDocumentAccessor implements DocumentAccessor {
|
|||||||
.executeTakeFirst() as { id: number };
|
.executeTakeFirst() as { id: number };
|
||||||
const id = id_lst.id;
|
const id = id_lst.id;
|
||||||
|
|
||||||
if (tags.length > 0){
|
|
||||||
// add tags
|
// add tags
|
||||||
await trx.insertInto("tags")
|
await trx.insertInto("tags")
|
||||||
.values(tags.map((x) => ({ name: x })))
|
.values(tags.map((x) => ({ name: x })))
|
||||||
// on conflict is supported in sqlite and postgresql.
|
// on conflict is supported in sqlite and postgresql.
|
||||||
.onConflict((oc) => oc.doNothing())
|
.onConflict((oc) => oc.doNothing())
|
||||||
.execute();
|
.execute();
|
||||||
}
|
|
||||||
|
|
||||||
if (tags.length > 0) {
|
if (tags.length > 0) {
|
||||||
await trx.insertInto("doc_tag_relation")
|
await trx.insertInto("doc_tag_relation")
|
||||||
@ -312,12 +310,10 @@ class SqliteDocumentAccessor implements DocumentAccessor {
|
|||||||
.where("doc_id", "=", c.id)
|
.where("doc_id", "=", c.id)
|
||||||
.execute();
|
.execute();
|
||||||
// update tags and doc_tag_relation
|
// update tags and doc_tag_relation
|
||||||
if (tags.length > 0) {
|
|
||||||
await trx.insertInto("tags")
|
await trx.insertInto("tags")
|
||||||
.values(tags.map((x) => ({ name: x })))
|
.values(tags.map((x) => ({ name: x })))
|
||||||
.onConflict((oc) => oc.doNothing())
|
.onConflict((oc) => oc.doNothing())
|
||||||
.execute();
|
.execute();
|
||||||
}
|
|
||||||
await trx.insertInto("doc_tag_relation")
|
await trx.insertInto("doc_tag_relation")
|
||||||
.values(tags.map((x) => ({ tag_name: x, doc_id: c.id }))
|
.values(tags.map((x) => ({ tag_name: x, doc_id: c.id }))
|
||||||
)
|
)
|
||||||
|
@ -22,16 +22,6 @@ export function getKysely() {
|
|||||||
kysely = new Kysely<DB>({
|
kysely = new Kysely<DB>({
|
||||||
dialect: createSqliteDialect(),
|
dialect: createSqliteDialect(),
|
||||||
// plugins: [new ParseJSONResultsPlugin()],
|
// plugins: [new ParseJSONResultsPlugin()],
|
||||||
log: (event) => {
|
|
||||||
if (event.level === "error") {
|
|
||||||
console.error("Query failed : ", {
|
|
||||||
durationMs: event.queryDurationMillis,
|
|
||||||
error: event.error,
|
|
||||||
sql: event.query.sql,
|
|
||||||
params: event.query.parameters,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return kysely;
|
return kysely;
|
||||||
|
Loading…
Reference in New Issue
Block a user