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