Skip to content
Snippets Groups Projects
Commit 6267fe1a authored by Bruno Burke's avatar Bruno Burke :hamburger:
Browse files

postgres: fix type casting of ds-type and ds-encoding

parent 213809d6
No related branches found
No related tags found
No related merge requests found
Pipeline #97921 failed
(defproject wwsoftware/document-storage "0.2.6"
(defproject wwsoftware/document-storage "0.2.7"
:description "FIXME: write description"
:repositories [["internal" {:url "https://leukipp.fh-muenster.de:9082/releases"
:username "anonymous"}]]
......
......@@ -44,7 +44,7 @@ SELECT document_id
-- :doc creates a new document frame record
INSERT INTO :i:repository-table
(document_id, data_type, data_encoding, version, reference, "data")
VALUES (:document-id, CAST(:type AS :i:ds-type-fqn), :encoding, :version, :reference, :data)
VALUES (:document-id, CAST(:type::varchar AS :i:ds-type-fqn), CAST(:encoding::varchar AS :i:ds-encoding-fqn), :version, :reference, :data)
--;; TODO type cast is problematic with multiple storage schemas in one database
......
......@@ -68,8 +68,8 @@
(.run-query storage :create-document-frame!
{:repository repository
:document-id document-id
:type :ds-type/key
:encoding :ds-encoding/nippy
:type "key"
:encoding "nippy"
:version (inc last-version)
:reference nil
:data doc})))
......@@ -83,8 +83,8 @@
(.run-query storage :create-document-frame!
{:repository repository
:document-id document-id
:type :ds-type/diff
:encoding :ds-encoding/nippy
:type "diff"
:encoding "nippy"
:version (inc last-version)
:reference (:id last-frame) ;;;FIXME save ID in reference not version
:data diff-doc})))
......@@ -103,8 +103,8 @@
(.run-query storage :create-document-frame!
{:repository repository
:document-id document-id
:type :ds-type/delete
:encoding :ds-encoding/edn
:type "delete"
:encoding "edn"
:version (inc (:version (get-last-document-version storage document-id repository)))
:reference nil
:data (encoding/encode-document "")}))
......@@ -16,7 +16,7 @@
(is (= structure
(.load-document @ds-atom id repo)))
(.delete-document @ds-atom id repo)
(is (not (.load-document @ds-atom id repo)) "Deleted documents should not be loadable with .load-document")
(is (thrown? Exception (not (.load-document @ds-atom id repo))) "Deleted documents should not be loadable with .load-document")
(is (not (some #{id} (.list-documents @ds-atom repo))) "Deleted documents should not be listed with .list-documents"))))
(defn test-versioning [ds-atom]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment