commit
24f76c0678
@ -70,12 +70,12 @@ def get_sqlite3_cursor(path, copy=False):
|
|||||||
conn = sqlite3.connect(path)
|
conn = sqlite3.connect(path)
|
||||||
atexit.register(conn.close)
|
atexit.register(conn.close)
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
for name, in cur.execute('SELECT name FROM sqlite_master'):
|
names = set(name for name, in cur.execute('SELECT name FROM sqlite_master'))
|
||||||
if name == 'bitrot':
|
if 'bitrot' not in names:
|
||||||
break
|
|
||||||
else:
|
|
||||||
cur.execute('CREATE TABLE bitrot (path TEXT PRIMARY KEY, '
|
cur.execute('CREATE TABLE bitrot (path TEXT PRIMARY KEY, '
|
||||||
'mtime INTEGER, hash TEXT, timestamp TEXT)')
|
'mtime INTEGER, hash TEXT, timestamp TEXT)')
|
||||||
|
if 'bitrot_hash_idx' not in names:
|
||||||
|
cur.execute('CREATE INDEX bitrot_hash_idx ON bitrot (hash)')
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user