feat(storage): add native PostgreSQL runtime and verified offline application import
Build and publish container images / images (push) Failing after 12m29s
Build and publish container images / images (push) Failing after 12m29s
This commit is contained in:
1 parent
96065d1e89
commit
0ba1dcfef0
243 files changed
+21441
-3090
No files matched your search
@@ -199,6 +199,10 @@ func (s *Store) DocumentReferencesInDomain(domainUUID, hash string) ([]DocumentR
|
||||
if !validDocumentHash(hash) {
|
||||
return nil, sql.ErrNoRows
|
||||
}
|
||||
tie := "r.rowid"
|
||||
if s.sqlBackend == storePostgreSQL {
|
||||
tie = "r.uuid"
|
||||
}
|
||||
rows, err := s.DB.Query(`
|
||||
SELECT r.uuid,r.object_uuid,COALESCE(r.document_hash,''),
|
||||
COALESCE(NULLIF(r.lang,''),'und'),
|
||||
@@ -207,13 +211,13 @@ func (s *Store) DocumentReferencesInDomain(domainUUID, hash string) ([]DocumentR
|
||||
COALESCE(r.created_at,0),
|
||||
COALESCE(r.created_at_ms,COALESCE(r.created_at,0)*1000),p.path
|
||||
FROM revisions r
|
||||
JOIN paths p ON p.object_uuid=r.object_uuid AND p.domain_uuid=?
|
||||
WHERE r.document_hash=? OR EXISTS (
|
||||
JOIN paths p ON p.object_uuid=r.object_uuid AND p.domain_uuid=`+s.sqlParam(1)+`
|
||||
WHERE r.document_hash=`+s.sqlParam(2)+` OR EXISTS (
|
||||
SELECT 1 FROM revision_document_refs x
|
||||
WHERE x.revision_uuid=r.uuid AND x.document_hash=?
|
||||
WHERE x.revision_uuid=r.uuid AND x.document_hash=`+s.sqlParam(3)+`
|
||||
)
|
||||
ORDER BY COALESCE(r.created_at_ms,r.created_at*1000) DESC,
|
||||
COALESCE(p.is_primary,0) DESC,p.path,r.rowid DESC
|
||||
COALESCE(p.is_primary,0) DESC,p.path,`+tie+` DESC
|
||||
LIMIT 256
|
||||
`, domainUUID, hash, hash)
|
||||
if err != nil {
|
||||
@@ -303,6 +307,9 @@ func (s *Store) EnsureDocumentStoreContext(ctx context.Context) error {
|
||||
func (s *Store) hydrateRevision(
|
||||
revision *Revision,
|
||||
) (*Revision, error) {
|
||||
if s.sqlBackend == storePostgreSQL && s.DocumentRoot == "" {
|
||||
return nil, ErrDocumentStoreRequired
|
||||
}
|
||||
if revision == nil || s.DocumentRoot == "" {
|
||||
return revision, nil
|
||||
}
|
||||
@@ -313,6 +320,11 @@ func (s *Store) hydrateRevision(
|
||||
)
|
||||
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
// Native saves never retain a body cache. Missing canonical data must
|
||||
// not be silently reconstructed as an empty document on a read.
|
||||
if s.sqlBackend == storePostgreSQL {
|
||||
return nil, err
|
||||
}
|
||||
if err := s.persistDocument(
|
||||
revision.DocumentHash,
|
||||
revision.Body,
|
||||
|
||||
Reference in new issue
Block a user