fix dev scripts: explicitly set clientDateModified in Zotero INSERTs
Omitting clientDateModified lets SQLite's DEFAULT CURRENT_TIMESTAMP fill it with 'YYYY-MM-DD HH:MM:SS' (no T, no Z), which the Zotero sync engine rejects. All INSERT INTO items statements now include clientDateModified with the ISO 8601 now value.
This commit is contained in:
@@ -81,9 +81,9 @@ def add_carrier_year(db: sqlite3.Connection, year: int, info: dict) -> None:
|
||||
parent_key = _zotero_key()
|
||||
db.execute(
|
||||
"""INSERT INTO items (itemID, itemTypeID, dateAdded, dateModified,
|
||||
key, version, synced, libraryID)
|
||||
VALUES (?, ?, ?, ?, ?, 0, 0, 1)""",
|
||||
(parent_id, ITEM_TYPE_WEBPAGE, now, now, parent_key),
|
||||
clientDateModified, key, version, synced, libraryID)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 1)""",
|
||||
(parent_id, ITEM_TYPE_WEBPAGE, now, now, now, parent_key),
|
||||
)
|
||||
|
||||
# Set fields: title, date, url, accessDate, websiteType, websiteTitle
|
||||
@@ -145,7 +145,7 @@ def add_carrier_year(db: sqlite3.Connection, year: int, info: dict) -> None:
|
||||
"""INSERT INTO items (itemID, itemTypeID, dateAdded, dateModified,
|
||||
key, version, synced, libraryID)
|
||||
VALUES (?, ?, ?, ?, ?, 0, 0, 1)""",
|
||||
(att_id, ITEM_TYPE_ATTACHMENT, now, now, att_key),
|
||||
(att_id, ITEM_TYPE_ATTACHMENT, now, now, now, att_key),
|
||||
)
|
||||
|
||||
# Create attachment record (linkMode=0 = imported file)
|
||||
|
||||
@@ -132,9 +132,9 @@ def add_zipcode_year(db: sqlite3.Connection, year: int, info: dict) -> None:
|
||||
parent_key = _zotero_key()
|
||||
db.execute(
|
||||
"""INSERT INTO items (itemID, itemTypeID, dateAdded, dateModified,
|
||||
key, version, synced, libraryID)
|
||||
VALUES (?, ?, ?, ?, ?, 0, 0, 1)""",
|
||||
(parent_id, ITEM_TYPE_WEBPAGE, now, now, parent_key),
|
||||
clientDateModified, key, version, synced, libraryID)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 1)""",
|
||||
(parent_id, ITEM_TYPE_WEBPAGE, now, now, now, parent_key),
|
||||
)
|
||||
|
||||
fields = {
|
||||
@@ -194,7 +194,7 @@ def add_zipcode_year(db: sqlite3.Connection, year: int, info: dict) -> None:
|
||||
"""INSERT INTO items (itemID, itemTypeID, dateAdded, dateModified,
|
||||
key, version, synced, libraryID)
|
||||
VALUES (?, ?, ?, ?, ?, 0, 0, 1)""",
|
||||
(att_id, ITEM_TYPE_ATTACHMENT, now, now, att_key),
|
||||
(att_id, ITEM_TYPE_ATTACHMENT, now, now, now, att_key),
|
||||
)
|
||||
db.execute(
|
||||
"""INSERT INTO itemAttachments
|
||||
|
||||
@@ -425,9 +425,9 @@ def register_in_zotero(
|
||||
con.execute(
|
||||
"""INSERT INTO items
|
||||
(itemID, itemTypeID, dateAdded, dateModified,
|
||||
key, version, synced, libraryID)
|
||||
VALUES (?, ?, ?, ?, ?, 0, 0, 1)""",
|
||||
(next_id, ZOTERO_TYPE_WEBPAGE, now, now, parent_key),
|
||||
clientDateModified, key, version, synced, libraryID)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 1)""",
|
||||
(next_id, ZOTERO_TYPE_WEBPAGE, now, now, now, parent_key),
|
||||
)
|
||||
|
||||
_set_zotero_field(con, next_id, ZOTERO_FIELD_TITLE, spec.title)
|
||||
@@ -479,9 +479,9 @@ def register_in_zotero(
|
||||
con.execute(
|
||||
"""INSERT INTO items
|
||||
(itemID, itemTypeID, dateAdded, dateModified,
|
||||
key, version, synced, libraryID)
|
||||
VALUES (?, ?, ?, ?, ?, 0, 0, 1)""",
|
||||
(att_id, ZOTERO_TYPE_ATTACHMENT, now, now, att_key),
|
||||
clientDateModified, key, version, synced, libraryID)
|
||||
VALUES (?, ?, ?, ?, ?, ?, 0, 0, 1)""",
|
||||
(att_id, ZOTERO_TYPE_ATTACHMENT, now, now, now, att_key),
|
||||
)
|
||||
con.execute(
|
||||
"""INSERT INTO itemAttachments
|
||||
|
||||
Reference in New Issue
Block a user