
CREATE TABLE organization (
    id bigserial PRIMARY KEY
);


CREATE TABLE _organization_data (
    id serial PRIMARY KEY,
    _start_t timestamp NOT NULL,
    _end_t timestamp,
    _table bigint NOT NULL,
    own_entity bigint
);

ALTER TABLE _organization_data ADD CONSTRAINT _table_fk FOREIGN KEY (_table) REFERENCES organization;
ALTER TABLE _organization_data ADD CONSTRAINT own_entity_fk FOREIGN KEY (own_entity) REFERENCES own_entity;