create table certification
(
    id            bigint generated by default as identity,
    credential_id varchar(255),
    date          varchar(255),
    issuer        varchar(255),
    name          varchar(255),
    primary key (id)
);

create table education
(
    id          bigint generated by default as identity,
    degree      varchar(255),
    description text,
    grade       varchar(255),
    institution varchar(255),
    period      varchar(255),
    primary key (id)
);

create table experience
(
    id          bigint generated by default as identity,
    company     varchar(255),
    description text,
    location    varchar(255),
    period      varchar(255),
    position    varchar(255),
    primary key (id)
);

create table experience_achievement
(
    id            bigint generated by default as identity,
    description   text,
    experience_id bigint,
    primary key (id)
);

create table experience_skill
(
    id            bigint generated by default as identity,
    name          varchar(255),
    experience_id bigint,
    primary key (id)
);

create table personal
(
    id       bigint generated by default as identity,
    avatar   varchar(255),
    bio      varchar(255),
    email    varchar(255),
    location varchar(255),
    name     varchar(255),
    phone    varchar(255),
    subtitle varchar(255),
    title    varchar(255),
    primary key (id)
);

create table personal_social_link
(
    id          bigint generated by default as identity,
    platform    varchar(255),
    url         varchar(255),
    personal_id bigint not null,
    primary key (id)
);

create table project
(
    id          bigint generated by default as identity,
    demo        varchar(255),
    description varchar(255),
    image       varchar(255),
    repository  varchar(255),
    title       varchar(255),
    primary key (id)
);

create table project_feature
(
    id         bigint generated by default as identity,
    name       varchar(255),
    project_id bigint,
    primary key (id)
);

create table project_feature_technology
(
    id         bigint generated by default as identity,
    name       varchar(255),
    project_id bigint,
    primary key (id)
);

create table skill
(
    id       bigint generated by default as identity,
    level    integer,
    name     varchar(255),
    years    integer,
    skill_id bigint,
    primary key (id)
);

create table skill_group
(
    id   bigint generated by default as identity,
    icon varchar(255),
    name varchar(255),
    primary key (id)
);

alter table if exists experience_achievement
    add constraint FK94xrk6stofkung8skwplo29nd
        foreign key (experience_id)
            references experience;

alter table if exists experience_skill
    add constraint FKpr3jdfjjlaubuayoafpwyx2al
        foreign key (experience_id)
            references experience;

alter table if exists profile_social_link
    add constraint FKfh1pbfvvg3palcr1yip6jffik
        foreign key (PROFILE_ID)
            references profile;

alter table if exists project_feature
    add constraint FKdifppyvrfito5in15ox4db0up
        foreign key (project_id)
            references project;

alter table if exists project_feature_technology
    add constraint FK15krsajtovetpg5vsaqj3icwf
        foreign key (project_id)
            references project;

alter table if exists skill
    add constraint FKi819li5g5cp5qbsyenhr3kmef
        foreign key (skill_id)
            references skill_group;