fhirbase / fhirbase-plv8

[DEPRECATED] Fhirbase 2.0 is an FHIR relational storage
https://health-samurai.io/fhirbase
Other
105 stars 39 forks source link

Transactions are not rolled back on failure #112

Closed Andrzej-Pietrzak closed 8 years ago

Andrzej-Pietrzak commented 8 years ago

SELECT fhir_create_resource('{"allowId": true, "resource": {"id": "id1", "resourceType": "Patient","name": [{"given": ["Jim"]}], "identifier": [{"use": "official", "value": "0987", "system": "test"}]}}');

-- delete the existing patient, post a new one and then a failing create with update (supplied with different order) SELECT fhir_transaction('{"resourceType":"Bundle","id":"bundle-transaction","type":"transaction","entry":[{"resource":{"resourceType":"Patient","name":[{"use":"official","family":["Chalmers"],"given":["Peter","James"]}],"gender":"male","birthDate":"1974-12-25","active":true},"request":{"method":"POST","url":"/Patient"}},{"resource":{"name":[{"use":"official","family":["Martin"],"given":["Bob"]}],"gender":"male","birthDate":"1955-05-05","active":true},"request":{"method":"PUT","url":"/Patient/1234"}},{"request":{"method":"DELETE","url":"/Patient/id1"}}]}'); SELECT fhir_read_resource('{"resourceType": "Patient", "id": "id1"}'); -- nok, delete was commited

bartek-sarul commented 8 years ago

As we can do the transaction on client level we still need this to return proper result even when failure occurs

danil commented 8 years ago

@Andrzej-Pietrzak @bartek-sarul fixed in v1.3.0.15 https://github.com/fhirbase/fhirbase-plv8/blob/v1.3.0.15/test/integration_spec.coffee#L828 if not, feel free to reopen