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" :description "FIXME: write description"
:repositories [["internal" {:url "https://leukipp.fh-muenster.de:9082/releases" :repositories [["internal" {:url "https://leukipp.fh-muenster.de:9082/releases"
:username "anonymous"}]] :username "anonymous"}]]
......
...@@ -44,7 +44,7 @@ SELECT document_id ...@@ -44,7 +44,7 @@ SELECT document_id
-- :doc creates a new document frame record -- :doc creates a new document frame record
INSERT INTO :i:repository-table INSERT INTO :i:repository-table
(document_id, data_type, data_encoding, version, reference, "data") (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 --;; TODO type cast is problematic with multiple storage schemas in one database
......
...@@ -68,8 +68,8 @@ ...@@ -68,8 +68,8 @@
(.run-query storage :create-document-frame! (.run-query storage :create-document-frame!
{:repository repository {:repository repository
:document-id document-id :document-id document-id
:type :ds-type/key :type "key"
:encoding :ds-encoding/nippy :encoding "nippy"
:version (inc last-version) :version (inc last-version)
:reference nil :reference nil
:data doc}))) :data doc})))
...@@ -83,8 +83,8 @@ ...@@ -83,8 +83,8 @@
(.run-query storage :create-document-frame! (.run-query storage :create-document-frame!
{:repository repository {:repository repository
:document-id document-id :document-id document-id
:type :ds-type/diff :type "diff"
:encoding :ds-encoding/nippy :encoding "nippy"
:version (inc last-version) :version (inc last-version)
:reference (:id last-frame) ;;;FIXME save ID in reference not version :reference (:id last-frame) ;;;FIXME save ID in reference not version
:data diff-doc}))) :data diff-doc})))
...@@ -103,8 +103,8 @@ ...@@ -103,8 +103,8 @@
(.run-query storage :create-document-frame! (.run-query storage :create-document-frame!
{:repository repository {:repository repository
:document-id document-id :document-id document-id
:type :ds-type/delete :type "delete"
:encoding :ds-encoding/edn :encoding "edn"
:version (inc (:version (get-last-document-version storage document-id repository))) :version (inc (:version (get-last-document-version storage document-id repository)))
:reference nil :reference nil
:data (encoding/encode-document "")})) :data (encoding/encode-document "")}))
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
(is (= structure (is (= structure
(.load-document @ds-atom id repo))) (.load-document @ds-atom id repo)))
(.delete-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")))) (is (not (some #{id} (.list-documents @ds-atom repo))) "Deleted documents should not be listed with .list-documents"))))
(defn test-versioning [ds-atom] (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