Skip to content

How to change dataset from checkedOut to checkedIn (in DB)

Andreas Ostrowski edited this page Jul 26, 2021 · 8 revisions

CheckedOut to CheckedIn

  1. Important: Do not change or delete directly in the database without a current backup!
  2. Important: Depending on the reason for checkedOut either keep the new dataset version or delete it.
  3. Important: Check if data has been uploaded!

Checks

Data uploaded check

  • get latest datasetVersion-ID
    SELECT max(id) FROM public.datasetversions WHERE datasetref = 'your dataset-ID';

  • Check if data has been uploaded
    SELECT * FROM public.datatuples WHERE datasetversionref = datasetVersion-ID

If the SELECT gives a result, data has been uploaded.

Data versions check on primary data

  • Identify datasetVersion-IDs as described above
  • Use them on the primary data versions SELECT * FROM public.datatupleversions where actingdatasetversionref in (datasetVersion-IDs)

Keep Dataset version

Table Datasets

  • Set status to „2“
  • remove name from “checkoutuser”

Table Datasetversions

  • Filter by Dataset ID: SELECT * FROM public.datasetversions WHERE datasetref = 'dataset-ID' ORDER BY id DESC;
  • Set status 2

Delete Dataset version

Check if data has been uploaded (see above).

If data has been uploaded,

the question is, if the latest upload created new versions of existing data (append or edit?).

  • If yes

    • Removing versions will be a difficult task.
    • Up to now, there is no experience. Please speak to the BEXIS2 developers about it.
  • If no

    • The data tuples needs to be deleted.
    • Identify the tuples which needs to be removed (see checks above).
    • Delete it with the statement below, here with an additional constraint example DELETE FROM public.datatuples WHERE datasetversionref in (datasetVersion-ID) and values like '%2019%'

If no data has been uploaded:

Table datasets

  • Set status to „2“
  • remove name from “checkoutuser”

Table datasetversions

  • Filter by Dataset ID: SELECT * FROM datasetversions WHERE datasetref = 'dataset-ID' ORDER BY id DESC;

Table contentdescriptors (necessary if files have been uploaded in a previous step)

  • SELECT * FROM contentdescriptors WHERE datasetversionref in (newestest / 2nd newested dataset version-ID) If content is identical, delete all entries referring to the newest datasetversion ID

Table datasetversions

  • Filter by Dataset ID: SELECT * FROM datasetversions WHERE datasetref = 'dataset-ID' ORDER BY id DESC;
  • Delete newest datasetversion (status 1)
  • Set status 2 to the new newest Version
Clone this wiki locally