
    drop table EVENTS if exists;

    drop table EVENTS_AUD if exists;

    drop table REVINFO if exists;

    create table EVENTS (
        id bigint not null,
        EVENT_DATE timestamp,
        title varchar(255),
        primary key (id)
    );

    create table EVENTS_AUD (
        id bigint not null,
        REV integer not null,
        REVTYPE tinyint,
        EVENT_DATE timestamp,
        title varchar(255),
        primary key (id, REV)
    );

    create table REVINFO (
        REV integer generated by default as identity,
        REVTSTMP bigint,
        primary key (REV)
    );

    alter table EVENTS_AUD 
        add constraint FK_3hegaqrrpmx0jj0c8qacjtira 
        foreign key (REV) 
        references REVINFO;
