-- main data table
CREATE TABLE data (
data_id BIGSERIAL PRIMARY KEY, 
object_id INT REFERENCES object (object_id) MATCH SIMPLE, 
datatype_id INT REFERENCES datatype (datatype_id) MATCH SIMPLE, 
value TEXT,
current BOOLEAN,
user_id INT REFERENCES user (user_id) MATCH SIMPLE, 
drank INT, 
source_id INT REFERENCES source (source_id) MATCH SIMPLE, 
source_text TEXT,
precision REAL,
language_id INT REFERENCES language (language_id) MATCH SIMPLE,
timeline_start INT,
timeline_anchor INT,
timeline_end INT
);

CREATE INDEX data_object_id_idx ON data (object_id);
CREATE INDEX data_source_id_idx ON data (source_id);
CREATE INDEX data_user_id_idx ON data (user_id);

COMMENT ON COLUMN data.value IS 'all values as strings, search is not easily possible in this column';
