UNIQUE paths
This commit is contained in:
parent
82264ba9e5
commit
8098cc2748
|
@ -454,23 +454,28 @@ class WikiItem {
|
||||||
.then( () => this.localPath() )
|
.then( () => this.localPath() )
|
||||||
}
|
}
|
||||||
|
|
||||||
storeMetadata ( ) {
|
async storeMetadata ( ) {
|
||||||
const row = [
|
const row = [
|
||||||
this.urlKey(),
|
this.urlKey(),
|
||||||
this.titleKey(),
|
this.titleKey(),
|
||||||
this.revision,
|
this.revision,
|
||||||
this.mimeId(),
|
this.mimeId(),
|
||||||
]
|
]
|
||||||
return wiki.db.run(
|
try {
|
||||||
'INSERT INTO articles ( urlKey, titleKey, revision, mimeId ) VALUES ( ?,?,?,? )',
|
const res = await wiki.db.run(
|
||||||
row
|
'INSERT INTO articles ( urlKey, titleKey, revision, mimeId ) VALUES ( ?,?,?,? )',
|
||||||
)
|
row
|
||||||
.then( res => {
|
)
|
||||||
//~ log( 'storeMetadata res', res )
|
//~ log( 'storeMetadata res', row, res )
|
||||||
this.id = res.stmt.lastID
|
this.id = res.stmt.lastID
|
||||||
++ articleCount
|
++ articleCount
|
||||||
return this.id
|
return this.id
|
||||||
})
|
} catch ( err ) {
|
||||||
|
if ( err.code == "SQLITE_CONSTRAINT" )
|
||||||
|
return null
|
||||||
|
fatal( 'storeMetadata error', err )
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
save () {
|
save () {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user