create table group_id
(
    created_at timestamp(6) with time zone,
    updated_at timestamp(6) with time zone,
    group_id varchar(255),
    id varchar(255) not null
        constraint group_id_pkey
            primary key
);

create table artifact_id
(
    created_at timestamp(6) with time zone,
    updated_at timestamp(6) with time zone,
    artifact_id varchar(255),
    group_id varchar(255)
        constraint fkghhaxmc9rw9lhck83y9o6bp1o
            references group_id,
    group_id_long varchar(255),
    id varchar(255) not null
        constraint artifact_id_pkey
            primary key
);

create table release_version
(
    pull_count integer,
    last_pulled timestamp(6) with time zone,
    updated_at timestamp(6) with time zone,
    artifact_id varchar(255)
        constraint fk7c5hahrl7ws76sidh9d1434b8
            references artifact_id,
    artifact_id_long varchar(255),
    group_id_long varchar(255),
    id varchar(255) not null
        constraint release_version_pkey
            primary key,
    uploaded_by varchar(255),
    version varchar(255)
);

create table release_jar
(
    classifier varchar(255),
    filename varchar(255),
    id varchar(255) not null
        constraint release_jar_pkey
            primary key,
    md5 varchar(255),
    release_version_id varchar(255)
        constraint fkfbi277pdpmkulym55pq12eg0g
            references release_version,
    sha1 varchar(255),
    url varchar(255),
    jar bytea
);

create table release_pom
(
    updated_at timestamp(6) with time zone,
    filename varchar(255),
    id varchar(255) not null
        constraint release_pom_pkey
            primary key,
    md5 varchar(255),
    pom text,
    release_version_id varchar(255)
        constraint release_pom_release_version_id_key
            unique
        constraint fk3ojqytildpdfl7q3lf5xri1c6
            references release_version,
    sha1 varchar(255),
    url varchar(255)
);

create table resource
(
    is_snapshot boolean,
    artifact_id varchar(255),
    group_id varchar(255),
    id varchar(255) not null
        constraint resource_pkey
            primary key,
    version varchar(255)
);

create table event
(
    timestamp timestamp(6) with time zone,
    id varchar(255) not null
        constraint event_pkey
            primary key,
    resource_id varchar(255)
        constraint event_resource_id_key
            unique
        constraint fkclx5xnhdf2y3l1g3ae6ygsjmf
            references resource,
    type varchar(255)
        constraint event_type_check
            check ((type)::text = ANY ((ARRAY['UPLOAD'::character varying, 'DELETE'::character varying])::text[])),
	user_id varchar(255)
);

create table snapshot_version
(
    updated_at timestamp(6) with time zone,
    artifact_id varchar(255)
        constraint fk64mje366563n82s8hy9bkfr14
            references artifact_id,
    id varchar(255) not null
        constraint snapshot_version_pkey
            primary key,
    version varchar(255)
);

create table snapshot_bundle
(
    build_number integer,
    updated_at timestamp(6) with time zone,
    date varchar(255),
    id varchar(255) not null
        constraint snapshot_bundle_pkey
            primary key,
    snapshot_version_id varchar(255)
        constraint fk3ve4wtmuywedyrri24dnqrpd9
            references snapshot_version,
    time varchar(255),
    uploaded_by varchar(255)
);

create table snapshot_jar
(
    classifier varchar(255),
    id varchar(255) not null
        constraint snapshot_jar_pkey
            primary key,
    md5 varchar(255),
    sha1 varchar(255),
    snapshot_bundle_id varchar(255)
        constraint fkp2vmi4ih595cbhnwiq6q1yb2n
            references snapshot_bundle,
    jar bytea
);

create table snapshot_pom
(
    id varchar(255) not null
        constraint snapshot_pom_pkey
            primary key,
    md5 varchar(255),
    pom text,
    sha1 varchar(255),
    snapshot_bundle_id varchar(255)
        constraint snapshot_pom_snapshot_bundle_id_key
            unique
        constraint fkr9gdl40j7x0ch6raju9gitfr1
            references snapshot_bundle
);

create table token
(
    expires_at date,
    created_at timestamp(6) with time zone,
    id varchar(255) not null
        constraint token_pkey
            primary key,
    name varchar(255),
    token varchar(255),
    user_id varchar(255)
);

