diff --git a/src/memory/sqlite.py b/src/memory/sqlite.py index 18cf2be4..c1c7c321 100644 --- a/src/memory/sqlite.py +++ b/src/memory/sqlite.py @@ -82,7 +82,7 @@ DATABASE_SCHEMAS = { ('files', (("id TEXT NOT NULL", "version TEXT NOT NULL", "parent TEXT NOT NULL", "type TEXT CHECK(type in ('{file}', '{directory}')) NOT NULL DEFAULT '{file}'".format( file=C.FILE_TYPE_FILE, directory=C.FILE_TYPE_DIRECTORY), - "hash TEXT", "hash_algo TEXT", "name TEXT NOT NULL", "size INTEGER", + "file_hash TEXT", "hash_algo TEXT", "name TEXT NOT NULL", "size INTEGER", "namespace TEXT", "mime_type TEXT", "created DATETIME NOT NULL", "modified DATETIME", "owner TEXT", "access TEXT", "extra TEXT", "profile_id INTEGER"), @@ -101,7 +101,7 @@ DATABASE_SCHEMAS = { 5: {'create': {'files': (("id TEXT NOT NULL", "version TEXT NOT NULL", "parent TEXT NOT NULL", "type TEXT CHECK(type in ('{file}', '{directory}')) NOT NULL DEFAULT '{file}'".format( file=C.FILE_TYPE_FILE, directory=C.FILE_TYPE_DIRECTORY), - "hash TEXT", "hash_algo TEXT", "name TEXT NOT NULL", "size INTEGER", + "file_hash TEXT", "hash_algo TEXT", "name TEXT NOT NULL", "size INTEGER", "namespace TEXT", "mime_type TEXT", "created DATETIME NOT NULL", "modified DATETIME", "owner TEXT", "access TEXT", "extra TEXT", "profile_id INTEGER"), @@ -696,7 +696,7 @@ class SqliteStorage(object): if unique: query_parts.append('DISTINCT') if projection is None: - projection = ['id', 'version', 'parent', 'type', 'hash', 'hash_algo', 'name', + projection = ['id', 'version', 'parent', 'type', 'file_hash', 'hash_algo', 'name', 'size', 'namespace', 'mime_type', 'created', 'modified', 'owner', 'access', 'extra'] query_parts.append(','.join(projection)) @@ -717,7 +717,7 @@ class SqliteStorage(object): filters.append(u'type=?') args.append(type_) if file_hash is not None: - filters.append(u'hash=?') + filters.append(u'file_hash=?') args.append(file_hash) if hash_algo is not None: filters.append(u'hash_algo=?') @@ -785,7 +785,7 @@ class SqliteStorage(object): """ if extra is not None: assert isinstance(extra, dict) - query = ('INSERT INTO files(id, version, parent, type, hash, hash_algo, name, size, namespace, ' + query = ('INSERT INTO files(id, version, parent, type, file_hash, hash_algo, name, size, namespace, ' 'mime_type, created, modified, owner, access, extra, profile_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)') d = self.dbpool.runQuery(query, (file_id, version.strip(), parent, type_, file_hash, hash_algo,