Fix missing store table row after Store.init()
This commit is contained in:
parent
7a0fea9a80
commit
e76489b1c0
@ -88,7 +88,7 @@ CREATE TABLE store (
|
||||
-- We do not support renaming files.
|
||||
CREATE TABLE filedir (
|
||||
sha256 TEXT PRIMARY KEY NOT NULL,
|
||||
store TEXT NOT NULL,
|
||||
store TEXT NOT NULL REFERENCES store ON UPDATE CASCADE,
|
||||
name TEXT, -- only a filename, not a path
|
||||
parent TEXT REFERENCES filedir ON UPDATE CASCADE,
|
||||
UNIQUE(store, name, parent)
|
||||
|
||||
@ -95,10 +95,13 @@ class Store:
|
||||
conn.commit()
|
||||
cur.close()
|
||||
|
||||
new_uuid = str(uuid.uuid4())
|
||||
new_store = cls(directory=directory, conn=conn, uuid=new_uuid)
|
||||
new_store = cls(directory=directory, conn=conn, uuid=str(uuid.uuid4()))
|
||||
# generate a new UUID for this store
|
||||
with new_store.committing() as cur:
|
||||
cur.execute(
|
||||
"INSERT INTO store VALUES (?)",
|
||||
(new_store.uuid,),
|
||||
)
|
||||
cur.execute(
|
||||
'INSERT INTO local_metadata VALUES ("store_uuid", ?)',
|
||||
(new_store.uuid,),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user