INSERT OR REPLACE SQL on static value
This commit is contained in:
parent
bb34a4dd87
commit
bcd2cfa895
1 changed files with 5 additions and 3 deletions
|
@ -6,6 +6,7 @@ latest_db_version = 0
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Storage(object):
|
class Storage(object):
|
||||||
def __init__(self, db_path):
|
def __init__(self, db_path):
|
||||||
"""Setup the database
|
"""Setup the database
|
||||||
|
@ -34,7 +35,8 @@ class Storage(object):
|
||||||
|
|
||||||
# Sync token table
|
# Sync token table
|
||||||
self.cursor.execute("CREATE TABLE sync_token ("
|
self.cursor.execute("CREATE TABLE sync_token ("
|
||||||
"token TEXT PRIMARY KEY"
|
"dedupe_id INTEGER PRIMARY KEY, "
|
||||||
|
"token TEXT NOT NULL"
|
||||||
")")
|
")")
|
||||||
|
|
||||||
logger.info("Database setup complete")
|
logger.info("Database setup complete")
|
||||||
|
@ -69,6 +71,6 @@ class Storage(object):
|
||||||
Args:
|
Args:
|
||||||
token (str): A next_batch token as part of a sync response
|
token (str): A next_batch token as part of a sync response
|
||||||
"""
|
"""
|
||||||
self.cursor.execute("INSERT OR REPLACE INTO sync_token"
|
self.cursor.execute("INSERT OR REPLACE INTO sync_token "
|
||||||
" (token) VALUES (?)", (token,))
|
"(dedupe_id, token) VALUES (1, ?)", (token,))
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
|
Loading…
Reference in a new issue