This commit is contained in:
2022-12-26 18:03:46 +00:00
parent 19e0037511
commit fac5b03007
9 changed files with 158 additions and 81 deletions

View File

@@ -429,7 +429,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
await ExecQueryAsync("CREATE TABLE afileattachment (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, "
+ "attachtoobjectid BIGINT NOT NULL, attachtosockType INTEGER NOT NULL, attachedbyuserid BIGINT NOT NULL REFERENCES auser (id), "
+ "attachtoobjectid BIGINT NOT NULL, attachtoatype INTEGER NOT NULL, attachedbyuserid BIGINT NOT NULL REFERENCES auser (id), "
+ "storedfilename TEXT NOT NULL, displayfilename TEXT NOT NULL, contenttype TEXT, lastmodified TIMESTAMPTZ NOT NULL, notes TEXT, exists BOOL NOT NULL, size BIGINT NOT NULL)");
//index required for ops that need to check if file already in db (delete, count refs etc)
@@ -438,7 +438,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//index for the common issue of checking if an object has an attachment and retrieving them
//note always query (where clause) in this same order for best performance
await ExecQueryAsync("CREATE INDEX idx_afileattachment_attachtoobjectid_attachtosockType ON afileattachment (attachtoobjectid, attachtosockType );");
await ExecQueryAsync("CREATE INDEX idx_afileattachment_attachtoobjectid_attachtoaType ON afileattachment (attachtoobjectid, attachtoaType );");
await ExecQueryAsync("CREATE TABLE aopsjob (gid uuid PRIMARY KEY, name TEXT NOT NULL, created TIMESTAMPTZ NOT NULL, exclusive BOOL NOT NULL, "
+ "startafter TIMESTAMPTZ NOT NULL, jobtype INTEGER NOT NULL, subtype INTEGER, objectid BIGINT, sockType INTEGER, jobstatus INTEGER NOT NULL, jobinfo TEXT)");